Re: Options in ListPlot and Plot
- To: mathgroup at smc.vnet.net
- Subject: [mg38637] Re: [mg38613] Options in ListPlot and Plot
- From: Jan Mangaldan <hokenjan at yahoo.com>
- Date: Wed, 1 Jan 2003 03:41:36 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Well, look at this:
In[1]:= Attributes[ListPlot]
Out[1]:= {Protected}
In[2]:= Attributes[Plot]
Out[2]:= {HoldAll,Protected}
The HoldAll attributes signify that the expressions are literally supplied to Plot[].
Since Plot[] expects a Sequence[] of objects (as opposed to a List[] of objects), it results in an error.
If you must put your options in a list in Plot[], you really need to use Evaluate[].
In contrast, since ListPlot[] does not have the HoldAll attribute, putting your options in a List[] works fine.
Hope this helps!
Jan M. (^_^)
Mike <mikeh1980 at optusnet.com.au> wrote: 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.