Re: List question
- To: mathgroup at smc.vnet.net
- Subject: [mg21012] Re: [mg20972] List question
- From: "Tomas Garza" <tgarza at mail.internet.com.mx>
- Date: Thu, 2 Dec 1999 21:41:24 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Bill [bcash at javanet.com] wrote: > I am making a list of lists to be used by MultipleListPlot. How do I > remove the outer brackets when I give it to the function? Perhaps you could be more specific. If you look at the example given in the Help Browser in Add-Ons Graphics`MultipleListPlot` it seems unnecesary to remove the outer brackets: In[1]:= << Graphics`MultipleListPlot` In[2]:= (list1 = Table[{x, Sin[2 Pi x]}, {x, 0, 1, 0.2}]; list2 = Table[{x, Cos[2 Pi x]}, {x, 0, 1, 0.1}]); (I deliberately modified the iterator in the first list so as to make them of different lengths, just to be a little more general) In[3]:= listOfLists = {list1, list2}; In[4]:= MultipleListPlot[listOfLists] The output is omitted here, but it was OK. In any case, if you really want to get rid of the outer brackets, you might use a combination of Flatten and Partition. Thus, for example, In[5]:= list1A = Partition[Flatten[Take[listOfLists, 1]], 2]; list2B = Partition[Flatten[Rest[listOfLists]], 2]; In[6]:= MultipleListPlot[list1A, list2B] will give the same result as above. Tomas Garza Mexico City