MathGroup Archive 2011

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

Search the Archive

Re: ListLinePlot starting at x=0 rather than x=1

  • To: mathgroup at smc.vnet.net
  • Subject: [mg123677] Re: ListLinePlot starting at x=0 rather than x=1
  • From: "McHale, Paul" <Paul.McHale at excelitas.com>
  • Date: Thu, 15 Dec 2011 04:54:53 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <201112121145.GAA12913@smc.vnet.net>

I believe there are two ways to represent data for list plot.  The first is:

{A,B,C} which are implicitly Y values and X is assumed to be {1,2,3}

If you want to force something else, it is easiest to use a list of list where each list is a coordinate pair.

Restating above, the actual list would be:

{{1,A},{2,B},{3,C}}

Back to your code and breaking it up a little more:

m = Table[Accumulate[RandomReal[{-1, 1}, 25]], {3}] (* Generate all three{A,B,C} lists (implicit x values) *)
m = Map[Table[{i - 1, #[[i]]}, {i, 1, Length[#]}] &, m]  (* Map each list onto Table[] to add explicit x value *)
ListLinePlot[m]





-----Original Message-----
From: pedro silva [mailto:pedro_silva58 at hotmail.com]
Sent: Monday, December 12, 2011 6:45 AM
To: mathgroup at smc.vnet.net
Subject: [mg123677] ListLinePlot starting at x=0 rather than x=1

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




  • Prev by Date: Re: Where do the notebooks for the Palettes live?
  • Next by Date: Re: reliably sort?
  • Previous by thread: Re: ListLinePlot starting at x=0 rather than x=1
  • Next by thread: Re: ListLinePlot starting at x=0 rather than x=1