Re: Help coloring plot
- To: mathgroup@smc.vnet.net
- Subject: [mg11273] Re: [mg11240] Help coloring plot
- From: Sean Ross <seanross@worldnet.att.net>
- Date: Wed, 4 Mar 1998 01:39:28 -0500
- References: <199803030411.XAA02341@smc.vnet.net.>
Paul Bublitz wrote: > > I have a class assignment (hi Ken) to create a graph consisting of data > from a table plotted blue, a single point plotted in red, and lines > connecting the single point to the table plotted in greenish yellow. > I can plot each (point, table, and line) separately in the specified > colors. When I combine the individual plots into a module as shown > below, I only get a single color. How can I plot this in three > colors? > > plotpoly[sides_,point_]:= > Module[{p1,p2,p3,data}, > data=Table[{Cos[I 2.\[Pi]/sides],Sin[I 2.\[Pi]/sides]},{I,sides}]; > > p1=ListPlot[data,PlotStyle->PointSize[.03],DefaultColor- > >RGBColor[0,0,1],DisplayFunction->Identity]; > > p2=Graphics[{PointSize[.03],Point[point]},DefaultColor- > >RGBColor[1,0,0]]; > > p3=Graphics[Table[Line[{point,data[[I]]}],{I,sides}],DefaultColor- > >RGBColor[.8,1,0]; > > Show[{p1,p2,p3},Axes->False,AspectRatio->Automatic, > DisplayFunction->$DisplayFunction] > > ------------- > Paul Bublitz > tpa@radix.net Why are you using DefaultColor? When you combine plots with different "default colors", Mathematica must make some decision about which is the new "default color". DefaultColor does not assign a color to the graph, it changes the global or graphic default. If you want to assign a color to a graph, use PlotStyle. For example: > p1=ListPlot[data,PlotStyle->{PointSize[.03],RGBColor[0,0,1]},DisplayFunction->Identity]; -- Remove the _nospam_ in the return address to respond.
- References:
- Help coloring plot
- From: tpa@radix.net (Paul Bublitz)
- Help coloring plot