Drawing Polygons
- To: mathgroup at smc.vnet.net
- Subject: [mg45234] Drawing Polygons
- From: "flip" <flip_alpha at safebunch.com>
- Date: Tue, 23 Dec 2003 05:13:28 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Hello,
How can I get the second method to draw all of the points in a closed
polygon?
(* Method 1 ... do not like solid drawing *)
drawPoly[n_] := Module[{datalist},
datalist = Table[N[{Cos[t], Sin[t]}], {t, 0, 2 Pi, (2Pi)/n}];
Show[Graphics[Polygon[datalist]], AspectRatio -> Automatic]]
(* Try an example *)
drawPoly[5]
(* Method 2 ... does not draw closed polygons? *)
ComplexListPlot[points_, options___] :=
ListPlot[Map[{Re[#1], Im[#1]} &, points], options,
AxesLabel -> {"Re", "Im"}]
f[n_] := Table[N[Exp[2*Pi*I*a/n]], {a, 0, n - 1}]
datalist = f[5]
ComplexListPlot[datalist, PlotStyle -> PointSize[0.02], PlotJoined -> True]
How do I get the last plot to connect all of the points?
Thank you for any help.
To email, remove the _alpha1