Re: ListLinePlot starting at x=0 rather than x=1
- To: mathgroup at smc.vnet.net
- Subject: [mg123610] Re: ListLinePlot starting at x=0 rather than x=1
- From: "Oleksandr Rasputinov" <oleksandr_rasputinov at hmamail.com>
- Date: Tue, 13 Dec 2011 05:40:26 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <jc4pt0$cnj$1@smc.vnet.net>
On Mon, 12 Dec 2011 11:52:00 -0000, pedro silva
<pedro_silva58 at hotmail.com> wrote:
> greetings from a newbie!
> i'm trying to plot a bunch of numbers against n {0,1,2...}, something
> along the lines of (from the help)
> ListLinePlot[Table[Accumulate[RandomReal[{-1, 1}, 25]], {3}]]
> , but i need the lines to start at x=0, rather than 1. i expect this to
> be simple, but i can't find a way to do it. any help would be
> appreciated!
>
> cheers,
> pedro
>
There are two main ways to accomplish this.
The first is using the DataRange option:
ListLinePlot[
Table[
Accumulate[RandomReal[{-1, 1}, 25]],
{3}
],
DataRange -> {0, 24}
]
and the second is to give explicit abscissa and ordinate values for each
point:
ListLinePlot[
Table[
Transpose[{Range[0, 24], Accumulate[RandomReal[{-1, 1}, 25]]}],
{3}
]
]