Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #7154 > unrolled thread

ListLinePlot starting at x=0 rather than x=1

Started bypedro silva <pedro_silva58@hotmail.com>
First post2011-12-12 11:52 +0000
Last post2011-12-13 10:47 +0000
Articles 5 — 5 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  ListLinePlot starting at x=0 rather than x=1 pedro silva <pedro_silva58@hotmail.com> - 2011-12-12 11:52 +0000
    Re: ListLinePlot starting at x=0 rather than x=1 Roger Bagula <roger.bagula@gmail.com> - 2011-12-13 10:42 +0000
    Re: ListLinePlot starting at x=0 rather than x=1 Scott Colwell <srcolwell@gmail.com> - 2011-12-13 10:43 +0000
    Re: ListLinePlot starting at x=0 rather than x=1 "Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com> - 2011-12-13 10:44 +0000
    Re: ListLinePlot starting at x=0 rather than x=1 "Nasser M. Abbasi" <nma@12000.org> - 2011-12-13 10:47 +0000

#7154 — ListLinePlot starting at x=0 rather than x=1

Frompedro silva <pedro_silva58@hotmail.com>
Date2011-12-12 11:52 +0000
SubjectListLinePlot starting at x=0 rather than x=1
Message-ID<jc4pt0$cnj$1@smc.vnet.net>
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

[toc] | [next] | [standalone]


#7162

FromRoger Bagula <roger.bagula@gmail.com>
Date2011-12-13 10:42 +0000
Message-ID<jc7a66$onr$1@smc.vnet.net>
In reply to#7154
On Dec 12, 3:52 am, pedro silva <pedro_silv...@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

Make you list a parametric list:
Table[{x,f[x]},{x,0,n}]

[toc] | [prev] | [next] | [standalone]


#7164

FromScott Colwell <srcolwell@gmail.com>
Date2011-12-13 10:43 +0000
Message-ID<jc7a86$op9$1@smc.vnet.net>
In reply to#7154
Does this do what you want:

ListLinePlot[Table[Accumulate[RandomReal[{-1, 1}, 25]], {3}],
 DataRange -> {0, 25}]

[toc] | [prev] | [next] | [standalone]


#7167

From"Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com>
Date2011-12-13 10:44 +0000
Message-ID<jc7ab4$orf$1@smc.vnet.net>
In reply to#7154
On Mon, 12 Dec 2011 11:52:00 -0000, pedro silva  
<pedro_silva58@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}
  ]
]

[toc] | [prev] | [next] | [standalone]


#7172

From"Nasser M. Abbasi" <nma@12000.org>
Date2011-12-13 10:47 +0000
Message-ID<jc7ag3$ot5$1@smc.vnet.net>
In reply to#7154
On 12/12/2011 5:52 AM, pedro silva 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
>


May be use DataRange?

---------------------

nItems = 25;
data   = Table[Accumulate[RandomReal[{-1, 1}, nItems]], {3}];
ListLinePlot[data, DataRange -> {0, nItems - 1}]

---------------------

--Nasser

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web