MathGroup Archive 2005

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

Search the Archive

Re: Re: Apply on MultipleListPlot using pure functions


 

>-----Original Message-----
>From: Bill Rowe [mailto:readnewsciv at earthlink.net] 
To: mathgroup at smc.vnet.net
>Sent: Thursday, February 17, 2005 4:31 PM
>To: mathgroup at smc.vnet.net
>Subject: [mg54364] [mg54318] Re: Apply on MultipleListPlot using pure functions
>
>On 2/16/05 at 2:36 PM, pdickof at scf.sk.ca wrote:
>
>>I seem to be missing soomething with using Apply on pure functions.
>
>>The following lines work properly:
>>Needs["Graphics`MultipleListPlot`"]
>>MultipleListPlot[{1, 2, 3}, {4,5, 6}, {2, 3, 4}]; 
>>Apply[MultipleListPlot, {{1, 2, 3}, {4, 5, 6},{2, 3, 4}}];
>
>>but this does not. Why not? 
>>Apply[MultipleListPlot[#, Frame ->True]&,{{1, 2, 3},{4, 5, 6},{2, 3, 
>>4}}];
>
>I am not entirely sure why it doesn't work as expected, but
>
>MultipleListPlot[Sequence@@#,Frame->True]&@{{1,2,3},{4,5,6},{2,3,4}}; 
>
>does work
>


To investigate the why's, consider:

In[13]:=
Apply[f[#, Frame -> True] &, {{1, 2, 3}, {4, 5, 6}, {2, 3, 4}}]
Out[13]=
f[{1, 2, 3}, Frame -> True]

This keeps only the first argument (# is #1)!
So just ask for all:

In[14]:=
Apply[f[##, Frame -> True] &, {{1, 2, 3}, {4, 5, 6}, {2, 3, 4}}]
Out[14]=
f[{1, 2, 3}, {4, 5, 6}, {2, 3, 4}, Frame -> True]


Now MultipleListPlot for f will work too

In[15]:=
Apply[MultipleListPlot[##, Frame -> True] &, {{1, 2, 3}, {4, 5, 6}, {2,
3, 4}}]


--
Hartmut Wolf


  • Prev by Date: Memory Leak in Mathematica?
  • Next by Date: Controlling program flow across cells
  • Previous by thread: Re: Apply on MultipleListPlot using pure functions
  • Next by thread: EulerianCycle in graphs