Re: Plotting multi-column data

• To: mathgroup at smc.vnet.net
• Subject: [mg71143] Re: [mg71100] Plotting multi-column data
• From: Bob Hanlon <hanlonr at cox.net>
• Date: Thu, 9 Nov 2006 03:38:09 -0500 (EST)

```Needs["Graphics`"];

The multi-column data has the form

multiColumnData=Prepend[#[[2]],#[[1]]]&/@

{{x[1], y[1, 1], y[1, 2], y[1, 3], y[1, 4]}, {x[2], y[2, 1], y[2, 2], y[2, 3], y[2, 4]},
{x[3], y[3, 1], y[3, 2], y[3, 3], y[3, 4]}}

To convert to plot data

multiColumnData]

{{{x[1], y[1, 1]}, {x[2], y[2, 1]}, {x[3], y[3, 1]}}, {{x[1], y[1, 2]}, {x[2], y[2, 2]},
{x[3], y[3, 2]}}, {{x[1], y[1, 3]}, {x[2], y[2, 3]}, {x[3], y[3, 3]}},
{{x[1], y[1, 4]}, {x[2], y[2, 4]}, {x[3], y[3, 4]}}}

Using numbers to demonstrate the plots

plotData2=plotData/.{x[n_]:>n,y[n_,m_]:>Random[]};

Module[{n=Length[plotData2]},
MultipleListPlot[Sequence@@plotData2,
PlotJoined->True,
PlotStyle->Table[Hue[k/n],{k,n}]]];

Bob Hanlon

---- David Wood <dmwood at floyd.comcast.net> wrote:
> Howdy, all.
>
> I'd like to to plot multi-column data, a line of which might look like, e.g.:
>
> 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: Understanding N and Precision
• Next by Date: Re: comparing implicit 0 with machine floats
• Previous by thread: Re: Plotting multi-column data
• Next by thread: RE: Plotting multi-column data