MathGroup Archive 1998

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

Search the Archive

Help coloring plot



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



  • Prev by Date: experience with Global Optimization application?
  • Next by Date: Help with Discrete Math Problems
  • Prev by thread: experience with Global Optimization application?
  • Next by thread: Re: Help coloring plot