Re: Q:BarChart, MultipleListPlot
- To: mathgroup at smc.vnet.net
- Subject: [mg2521] Re: Q:BarChart, MultipleListPlot
- From: ianc (Ian Collier)
- Date: Thu, 16 Nov 1995 01:44:53 -0500
- Organization: Wolfram Research, Inc.
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 ----------------------------------------------------------- Ian Collier Technical Sales Support Wolfram Research, Inc. ----------------------------------------------------------- tel:(217)-398-0700 fax:(217)-398-0747 ianc at wri.com Wolfram Research Home Page: http://www.wri.com/ -----------------------------------------------------------