MathGroup Archive 1995

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

Search the Archive

Re: Q:BarChart, MultipleListPlot

  • To: mathgroup at smc.vnet.net
  • Subject: [mg2534] Re: Q:BarChart, MultipleListPlot
  • From: Jorma Virtamo <jorma.virtamo at vtt.fi>
  • Date: Fri, 17 Nov 1995 00:19:08 -0500

ianc at wri.com (Ian Collier) wrote:
>In article <48bvsj$3f2 at ralph.vnet.net>, Sascha at sunmail.lrz-muenchen.de,
>Unzicker at lrz.uni-muenchen.de wrote:
>
>> Maybe a stupid question:
>> 
>> Let a be a two-dimensional list.
>> Instead of 
>> BarChart[a[[1]],a[[2]],a[[3]],a[[4]]....]
>> I would prefer
>> BarChart[a]
>> or BarChart[Table[a[[n]],{n,4}]]
>> 
>> but Mathematica does not like it. Same thing with MultipleListPlot.
>> 
>> Any suggestions?
>> 
>> Thanks,
>> 
>> Alexander
>
>You can do this by converting the list of lists to a Sequence of
>lists by Applying Sequence to the 2 dimensional list.
>
>Here is an example using both BarChart and MultipleListPlot.
>
>In[68]:=
>    data = Table[ Random[], {4},{6} ]
>Out[68]=
>    {{0.648428, 0.230811, 0.442376, 0.115264, 0.966736, 
>       0.650595}, {0.958428, 0.752209, 0.648651, 0.164096, 
>       0.640159, 0.528314}, {0.892881, 0.928036, 0.557503, 
>       0.928651, 0.87035, 0.261039}, 
>      {0.874639, 0.531127, 0.635694, 0.394648, 0.093287, 
>       0.735063}}
>
>In[69]:=
>    Needs[ "Graphics`Graphics`" ]
>In[70]:=
>    ?BarChart
>
>    BarChart[list1, list2, ...] generates a bar chart of the
>       data in the lists.
>
>In[71]:=
>    ?Sequence
>
>    Sequence[e1,e2,...] is a special form representing a
>       sequence of arguments in an expression.
>
>In[72]:=
>    Apply[ Sequence, data ]
>Out[72]=
>    Sequence[{0.648428, 0.230811, 0.442376, 0.115264, 0.966736, 
>      0.650595}, {0.958428, 0.752209, 0.648651, 0.164096, 
>      0.640159, 0.528314}, {0.892881, 0.928036, 0.557503, 
>      0.928651, 0.87035, 0.261039}, 
>     {0.874639, 0.531127, 0.635694, 0.394648, 0.093287, 
>      0.735063}]
>
>In[73]:=
>    BarChart[ Apply[ Sequence, data ] ]
>Out[73]=
>    -Graphics-
>
>In[74]:=
>    Needs[ "Graphics`MultipleListPlot`" ]
>
>In[75]:=
>    MultipleListPlot[ Apply[ Sequence, data ] ,
>        PlotJoined -> True]
>Out[75]=
>    -Graphics-
>
>I hope this helps.
>
>--Ian
>

Wouldn't it be simpler just to write 
  
  BarChart @@ data

and

  MultipleListPlot @@ Append[data, PlotJoined -> True]

or

  MultipleListPlot[##, PlotJoined -> True]& @@ data


-- Jorma Virtamo


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Jorma Virtamo,  VTT Information Technology / Telecommunications
P.O. Box 1202,  FIN-02044 VTT,  Finland
phone: +358 0 456 5612          fax: +358 0 455 0115
email: jorma.virtamo at vtt.fi     web: http://www.vtt.fi/tte/



  • Prev by Date: How to write a loop
  • Next by Date: Mathematica Training
  • Previous by thread: Re: Q:BarChart, MultipleListPlot
  • Next by thread: MacTCP+PPP/ SuperBoomerang conflict?