MathGroup Archive 2003

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

Search the Archive

Re: Options in ListPlot and Plot

  • To: mathgroup at smc.vnet.net
  • Subject: [mg38621] Re: Options in ListPlot and Plot
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Wed, 1 Jan 2003 03:39:49 -0500 (EST)
  • References: <aur8vq$8gn$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Mike,
Plot has the attribute HoldAll and checks the form of input before any
evaluation.
Your problem has nothing to do with putting the options into a list.
Example:
    opts = Frame -> True;
    rng = {x, 0, 5};
    expr = x^2;
    Plot[expr, rng, Evaluate[opts]];
    Plot[expr, Evaluate[rng], opts];
    Plot[expr, Evaluate[rng], Evaluate[opts]];

A commonly observe consequence is to do with mulitiple plots.
Here Plot needs to know that it will be getting a list of formulas to plot.

    expr2 = {x,x^2};
    Plot[expr2,{x,0,5}, Frame->True];
    Plot[Evaluate[expr2],{x,0,5}, Frame->True];


"Mike" <mikeh1980 at optusnet.com.au> wrote in message
news:aur8vq$8gn$1 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.
>
>




  • Prev by Date: Re: easy(?) question on manipulating expressions
  • Next by Date: Re: scaling/translating Polyhedra - is this how??
  • Previous by thread: Re: Options in ListPlot and Plot
  • Next by thread: Re: Options in ListPlot and Plot