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


Groups > comp.soft-sys.math.mathematica > #7234

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

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!nx01.iad01.newshosting.com!newshosting.com!news-out.readnews.com!transit3.readnews.com!216.40.28.145.MISMATCH!novia!newspump.sol.net!posts.news.twtelecom.net!nnrp2.twtelecom.net!not-for-mail
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 Thu, 15 Dec 2011 10:02:26 +0000 (UTC)
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Sender steve@smc.vnet.net
Approved Steven M. Christensen <steve@smc.vnet.net>, Moderator
Message-ID <jccgji$mit$1@smc.vnet.net> (permalink)
References <201112121145.GAA12913@smc.vnet.net>
Lines 32
NNTP-Posting-Date 15 Dec 2011 09:07:09 GMT
NNTP-Posting-Host 880c09ac.news.twtelecom.net
X-Trace DXC==<QGi=loOGM:9cegTIC^\@C_A=>8kQj6Mm^eQlV`f18Gd>6a>Eh@bhKEFiONJ7[GoFDLWmmPB<0TE
X-Complaints-To abuse@twtelecom.net
Xref x330-a1.tempe.blueboxinc.net comp.soft-sys.math.mathematica:7234

Show key headers only | View raw


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


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