Re: plot variance(s)
- To: mathgroup at smc.vnet.net
- Subject: [mg51777] Re: [mg51749] plot variance(s)
- From: DrBob <drbob at bigfoot.com>
- Date: Mon, 1 Nov 2004 02:53:53 -0500 (EST)
- References: <200410310617.BAA16305@smc.vnet.net>
- Reply-to: drbob at bigfoot.com
- Sender: owner-wri-mathgroup at wolfram.com
>> Why doesn't p2 directly overlay the dots in p1?
ListPlot assumes the x-coordinates (when you don't specify them) are 1, ..., Length@data.
To get the right results, specify the x-coordinates:
data = Table[{x, Sin[x]}, {x, 0, 2*Pi}];
p1 = ListPlot[data, PlotStyle ->
{Red, PointSize[0.03]}, DisplayFunction ->
Identity];
p2 = Plot[Sin[x], {x, 0, 2*Pi},
DisplayFunction -> Identity];
Show[p1, p2, DisplayFunction ->
$DisplayFunction];
or
data = Table[Sin[x], {x, 0, 2*Pi}];
p1 = ListPlot[Transpose[{Range[0, 2*Pi], data}],
PlotStyle -> {Red, PointSize[0.03]},
DisplayFunction -> Identity];
p2 = Plot[Sin[x], {x, 0, 2*Pi},
DisplayFunction -> Identity];
Show[p1, p2, DisplayFunction -> $DisplayFunction];
or just
DisplayTogether[Graphics[{PointSize[0.03], Red,
Table[Point@{x, Sin[x]}, {x, 0, 2*Pi}]}],
Plot[Sin[x], {x, 0, 2*Pi}]];
I don't think ListPlot is very useful, in general.
Bobby
On Sun, 31 Oct 2004 01:17:31 -0500 (EST), Steven Shippee <slshippee at comcast.net> wrote:
> Input1: data = Table[Sin[x], {x, 0, 2\[Pi]}];
>
> Input 2: p1 = ListPlot[data,
> PlotStyle -> {Red, PointSize[0.03]}, DisplayFunction -> Identity];
>
> Input 3: p2 = Plot[Sin[x], {x, 0, 2\[Pi]}, DisplayFunction -> Identity];
>
> Input 4: Show[p1, p2, DisplayFunction -> $DisplayFunction];
>
> Why doesn't p2 directly overlay the dots in p1? Thanks in advance,
>
> Steven Shippee
>
> slshippee at comcast.net
>
> 360-493-8353
>
>
>
>
>
>
--
DrBob at bigfoot.com
www.eclecticdreams.net