Re: List of lists in MultipleListPlot, full message

• To: mathgroup at smc.vnet.net
• Subject: [mg9084] Re: [mg8936] List of lists in MultipleListPlot, full message
• From: John JOWETT <John.Jowett at cern.ch>
• Date: Mon, 13 Oct 1997 23:33:02 -0400
• Organization: CERN
• Sender: owner-wri-mathgroup at wolfram.com

```[My previous posting on this got truncated somehow.  Here is the full
thing again.   JMJ]

The answer to the question quoted below works as far as it goes.
However it may not be obvious what to do when you want to use
options of MultipleListPlot.  The technique is to
replace the head of the lists by Sequence, e.g., to plot
the data

d1 = Table[{x,Sin[x]},{x,0,10,.2}];
d2 = Table[{x,Cos[x]},{x,0,10,.2}];

on a yellow background, you can do

MultipleListPlot[d1,d2,Background->RGBColor[1,1,.5]]

However if the data comes as a list of lists like

dl = {d1,d2};

you can do
MultipleListPlot[Sequence @@ dl,Background->RGBColor[1,1,.5]]

To go further, it is often useful to construct a pure function.
Here is a way to vary the colours of the points for each sublist
making economical use of the colour spectrum according to the
number of sublists (which need not be known in advance):

MultipleListPlot[Sequence @@ # ,
SymbolStyle->Table[Hue[0.75 k/Length[#]],{k,1,Length[#]}]
]& @ dl

John Jowett

> At 22:08 4-10-97 -0400, Niklas Blomberg wrote:
> >Dear all,
> >
> >I would like to plot a list of lists with MultipleListPlot but the function
> >only accepts
> >individual lists as arguments ie:
> >
> >lists={{{1,1},{2,2}},{{2,1},{2,2}}};
> >Now MultipleListPlot[lists[[1]],lists[[2]]] works fine but is cumbersome with
> >many lists.
> >
> >What I would like to do of course is to plot "lists" directly - Flatten and
> >Map do not do the trick so are
> >there any suggestions?

W. Meeussen wrote:
>
> why resort to ...list[[n]]... if the Apply function does it for you?
>
> Apply[ MultipleListPlot,  lists  ]
> or
> MultipleListPlot @@ lists
>
> remember that Apply (@@) overwrites the outer Head of its argument:
>
> p @@ q[r] gives q[r]

--
-------------------------------------------------------------------------
World Wide Web:  http://wwwslap.cern.ch/~jowett/
-------------------------------------------------------------------------

```

• Prev by Date: Spellchecker?
• Next by Date: Calling Mathematica From Visual Basic and VBA: A Hands-On Workshop