Re: RE: Options in ListPlot and Plot
- To: mathgroup at smc.vnet.net
- Subject: [mg38643] Re: [mg38624] RE: [mg38613] Options in ListPlot and Plot
- From: Jan Mangaldan <hokenjan at yahoo.com>
- Date: Fri, 3 Jan 2003 00:14:59 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Well, for one thing, if ListPlot had the HoldAll attribute, the following wouldn't work:
In[1]:= pts=Table[Sin[u], {u,0,2 Pi, Pi/0}];
In[2]:= ListPlot[pts];
You'd have to wrap Evaluate[] around pts if you don't want to get a bunch of error messages .
If you want first-hand experience of how it would be if ListPlot had the HoldAll attribute, execute this:
In[3]:= Unprotect[ListPlot]; SetAttributes[ListPlot, HoldAll]; Protect[ListPlot];
and try to execute the commands I gave previously.
Jan M. (^_^)
David Park <djmp at earthlink.net> wrote: Mike,
Attributes[ListPlot]
{Protected}
Attributes[Plot]
{HoldAll, Protected}
I do not know why Mathematica is inconsistent here.
David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/
From: Mike [mailto:mikeh1980 at optusnet.com.au]
To: mathgroup at smc.vnet.net
For appearance reasons I usually place all my Plot and ListPlot options in a
list eg.
optionA={PlotStyle->{....},Frame->True, and so on}
When I plot a list everything is fine:
ListPlot[list, optionA]
out=> nice plot
but when I use options in Plot I get an error message unless I wrap Evaluate
around the options.
For example
Plot[x^2,{x,0,5}, optionB]
out=> messages
Plot[x^2,{x,0,5}, Evaluate[optionB]]
out=> nice plot
??? why is this so????
Why must I wrap Evaluate around my options in Plot?
thanks
Mike
ps. This is with version 4.0.2 on a G4 power Mac.