MathGroup Archive 2003

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

Search the Archive

RE: Drawing Polygons

  • To: mathgroup at smc.vnet.net
  • Subject: [mg45251] RE: [mg45234] Drawing Polygons
  • From: "David Park" <djmp at earthlink.net>
  • Date: Wed, 24 Dec 2003 04:35:53 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Polygon automatically add completes the polygon by joining the last point to
the first point. ListPlot does not, not does Line.

Use

f[5];
datalist = Join[%, {First[%]}];
ComplexListPlot[datalist, PlotStyle -> PointSize[0.02], PlotJoined -> True]

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/

From: flip [mailto:flip_alpha at safebunch.com]
To: mathgroup at smc.vnet.net

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




  • Prev by Date: Usage of "//" Operator
  • Next by Date: Politically incorrect response to Re: a bug in RealDigits? Mathematica 5.0
  • Previous by thread: Drawing Polygons
  • Next by thread: Re: Drawing Polygons