Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #7234
| From | "McHale, Paul" <Paul.McHale@excelitas.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: ListLinePlot starting at x=0 rather than x=1 |
| Date | 2011-12-15 10:02 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <jccgji$mit$1@smc.vnet.net> (permalink) |
| 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@hotmail.com]
Sent: Monday, December 12, 2011 6:45 AM
Subject: 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
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
Re: ListLinePlot starting at x=0 rather than x=1 "McHale, Paul" <Paul.McHale@excelitas.com> - 2011-12-15 10:02 +0000
csiph-web