RE: plot discrete spectrum
- To: mathgroup at smc.vnet.net
- Subject: [mg23295] RE: [mg23266] plot discrete spectrum
- From: "David Park" <djmp at earthlink.net>
- Date: Sun, 30 Apr 2000 21:13:45 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
>
> Is there an easy way to do a ListPlot[{{{x1, y1}, {x2, y2}, ..., {xn,
> yn}} in which each a perpendicular is dropped from each dot to the
> horizontal axis?
>
> Of course, when can combine the ListPlot with a Graphics object
> consisting of line segments. I prefer a way that avoids using graphics
> primitives directly.
>
> The sort of plot I want is what's usually done to display, for example,
> the energy spectrum of a Fourier series.
>
> --
> Murray Eisenberg murray at math.umass.edu
> Mathematics & Statistics Dept. phone 413 549-1020 (H)
> Univ. of Massachusetts 413 545-2859 (W)
> Amherst, MA 01003-4515
>
Murray,
I don't think it is possible to do away with the use of graphic primitives,
but we can hide them.
data = Table[{x, Sin[x]}, {x, 0, 2*Pi, 2*Pi/20}];
SpectrumPlot[data_, (opts___)?OptionQ] :=
Show[Graphics[{data /. {(x_)?NumericQ,
(y_)?NumericQ} -> Line[{{x, 0}, {x, y}}]}], opts]
SpectrumPlot[data, Axes -> True];
David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/