MathGroup Archive 2000

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

Search the Archive

Re: plot discrete spectrum

  • To: mathgroup at smc.vnet.net
  • Subject: [mg23494] Re: plot discrete spectrum
  • From: "John M. Jowett" <John.Jowett at cern.ch>
  • Date: Sun, 14 May 2000 16:59:58 -0400 (EDT)
  • Organization: CERN
  • References: <8eg6vb$hdm@smc.vnet.net> <8ekvbd$q98@smc.vnet.net> <lv2Q4.16$5j.710@ralph.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hello,
          I put this together in a little package after seeing the earlier
postings.  The auot-saved package file is quoted below.   I'll send the
implementation notebook (which contains examples) to anyone who asks rather
than posting it on the newsgroup.

So you can do things like

data = Table[{x, Random[]}, {x, 0, 2, .02}];

SpectralListPlot[data,
  Frame -> True, FrameLabel -> {"\[Omega]", "\[CapitalPhi]"},
  PlotStyle -> RGBColor[0, 0, 1], Background -> RGBColor[1, 1, .9]

Hope this helps,

John Jowett

(*-------------------------------------------------------------------*)

BeginPackage["MathMethods`SpectralPlot`"]

SpectralPlot::usage = "SpectralPlot.m is a package that provides functions for
plotting spectra."

SpectralListPlot::usage = "SpectralListPlot[data] works exactly like ListPlot
except that each point is joined to the horizontal axis by a line and the
PlotJoined option is ignored."


Begin["`Private`"]

Options[SpectralListPlot]=Select[Options[ListPlot],First[#1]=!=PlotJoined&]


SpectralListPlot[data_,opts___?OptionQ]:=Module[{pl,df},
    df=DisplayFunction/.{opts}/.Options[SpectralListPlot];
    pl=ListPlot[data,PlotJoined\[Rule]False,
          Evaluate[FilterOptions[ListPlot,opts]],
          DisplayFunction\[Rule]
            Identity]/.\[InvisibleSpace]Point[{x_,y_}]\[RuleDelayed]
          Line[{{x,y},{x,0}}];
    Show[pl,DisplayFunction\[Rule]df,Evaluate[FilterOptions[Graphics,opts]],
      Evaluate[FilterOptions[Graphics,Options[SpectralListPlot]]]]
    ]



End[ ]

EndPackage[ ]
(*-------------------------------------------------------------------*)


Murray Eisenberg wrote:

> Well, actually I want it with all the usual appurtenances of a ListPlot
> (axes, etc.).
>
> Jens-Peer Kuska wrote:
> >
> > Hi,
> >
> > something like this ?
> >
> > AmplitudePlot[l : {{_, _} ..}, opts___] :=
> >     Show[Graphics[{{AbsolutePointSize[4.5], Point /@ l},
> >         Line[{{First[#], 0}, #} ] & /@ l }, opts]]
> >
> > AmplitudePlot[l : {_?NumericQ ..}, opts___] :=
> >     AmplitudePlot[MapIndexed[{First[#2 - 1], #1} &, l], opts]
> >
> > Regards
> >   Jens
> >
> > Murray Eisenberg wrote:
> > >
> > > 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

--
mailto:John.Jowett at cern.ch
My home page:    http://wwwslap.cern.ch/~jowett/
Telephone:       +41 22 76 76643        [you can leave voice mail]
Fax:             +41 22 783 0552
Postal address:  SL Division,   CERN,   CH-1211 Geneva 23, Switzerland
Location:        Room 4-B22, Building 112, CERN Meyrin Site
Secretary:       +41 22 76 75272




  • Prev by Date: Re: RegionPlot ?
  • Next by Date: Parametric Solving Question From 14 Year Old
  • Previous by thread: Re: Re: plot discrete spectrum
  • Next by thread: Re: plot discrete spectrum