Re: Re: plot discrete spectrum

• To: mathgroup at smc.vnet.net
• Subject: [mg23401] Re: [mg23385] Re: [mg23266] plot discrete spectrum
• From: BobHanlon at AOL.com
• Date: Sat, 6 May 2000 02:26:44 -0400 (EDT)
• Sender: owner-wri-mathgroup at wolfram.com

```In a message dated 5/5/2000 2:20:17 AM, bernd at bio.vu.nl writes:

>I just noted the answer by Bob Hanlon.
>
>>>plt = (ListPlot[data, PlotStyle -> RGBColor[0, 0, 1],
>>>           DisplayFunction -> Identity, PlotRange -> All] /.
>>>         Point[{x_, y_}] :> Line[{{x, y}, {x, 0}}]);
>
>How can i extend this to plot a stepwise function? X are the datapoints.
>This means i have to plot to the next point, keeping the y value of the
>old.
>How can i extract two data points from the plot to make
>
>Point[{x1,y1}] Point[{x2,y2}] -> Line[{x1,y1},{x2,y1}] ?
>

Initial data:

data1 = Sort[Table[{x = 4Pi(Random[] - .5), Sin[x]/x}, {15}]];

plt1 = ListPlot[data1, PlotStyle -> RGBColor[1, 0, 0],
PlotRange -> All, PlotJoined -> True, DisplayFunction -> Identity] ;

Clear[x]

Fill in data points for stepwise function:

data2 = ((data1 //. {start___, {x1_?NumericQ, y1_?NumericQ},  {x2_?NumericQ,
y2_?NumericQ},
end___} :> {start, {x1, y1}, {Unique[x], y1},  {x2, y2},
end}) //. {start___, {x1_Symbol,
y1_?NumericQ},  {x2_?NumericQ, y2_?NumericQ},
end___} :> {start, {x2, y1},  {x2, y2}, end});

plt2 = ListPlot[data2, PlotStyle -> RGBColor[0, 0, 1],
PlotRange -> All, PlotJoined -> True, DisplayFunction -> Identity] ;

Show[{plt1, plt2}, DisplayFunction -> \$DisplayFunction];

Bob

BobHanlon at aol.com

```

• Prev by Date: animation on fixed background
• Next by Date: Re: Color Fill areas in 2D graphic
• Previous by thread: Re: plot discrete spectrum
• Next by thread: Re: plot discrete spectrum