MathGroup Archive 2006

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

Search the Archive

RE: Plotting multi-column data

  • To: mathgroup at
  • Subject: [mg71160] RE: [mg71100] Plotting multi-column data
  • From: "David Park" <djmp at>
  • Date: Thu, 9 Nov 2006 03:39:55 -0500 (EST)


Here is some sample data (of course, it is always better if the poster
provides a sample set of data so it might correspond to what he is doing and
save responders the time to make up data.)

data = Table[{x, Sin[x], Cos[x], x^2/(2Pi)^2} // Chop, {x, 0., 2Pi,

The following statement picks out the i'th set of data.

plotdata[i_] := Part[#, {1, i + 1}] & /@ data

The following plots all the data curves in one plot.

      {Table[Line[plotdata[i]], {i, 1, 3}]}],
    Frame -> True,
    ImageSize -> 350];

The following plots the curves in different colors and also adds the points.
You might want to add other directives such as AbsoluteDashing and if you
load MultipleListPlot you could also you Symbol or MakeSymbol (instead of
Point) to mark the points.

        Blue, Line[plotdata[2]],
        Red, Line[plotdata[3]],
        Black, AbsolutePointSize[4],
        Point /@ plotdata[1],
        Point /@ plotdata[2],
        Point /@ plotdata[3]}],
    Frame -> True,
    ImageSize -> 350];

David Park
djmp at

From: David Wood [mailto:dmwood at]
To: mathgroup at

Howdy, all.

I'd like to to plot multi-column data, a line of which might look like,

x1 y1 y2 y3 y4 y5

using Mathematica.  (I might have several tens of columns of data.)

(Yes, I know MultipleListPlot would handle sets like
{{x1,f1(x1)},{x2,f1(x2},..}} etc, but this requires clumsily defining
several dozen new standalone data arrays.)

How to accomplish this efficiently appears mystically opaque to my untutored
eyes, or perhaps I'm addled from too much US election coverage.  A Google
search on this group's archives, MathSource, and the Wolfram site with
the inoffensive keywords plot multi-column data yielded doodly-squat
(actually, less than that).

Any suggestions?
Many thanks!

  • Prev by Date: Re: comparing implicit 0 with machine floats
  • Next by Date: Re: Re: Evaluating integral with varying upper limit?
  • Previous by thread: Re: Plotting multi-column data
  • Next by thread: Possible bug concerning a limit computation