MathGroup Archive 1998

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Help coloring plot



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.



  • Prev by Date: Re: algebraic solutions
  • Next by Date: Re: Copying from Excel 97
  • Prev by thread: Help coloring plot
  • Next by thread: Re: Help coloring plot