Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Re: list of options in Plot

  • To: mathgroup at smc.vnet.net
  • Subject: [mg61931] Re: list of options in Plot
  • From: albert <awnl at arcor.de>
  • Date: Sat, 5 Nov 2005 01:52:13 -0500 (EST)
  • References: <dkcnrb$q81$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi Pieter,
 
> I need to plot functions with the same options all over again. For
> example
> 
> Plot[ x^2, {x,0,1}, PlotStyle->RBGColor[1,0,0], Ticks->None]
> Plot[ x^3, {x,0,1}, PlotStyle->RBGColor[1,0,0], Ticks->None]
> Plot[ x^4, {x,0,1}, PlotStyle->RBGColor[1,0,0], Ticks->None]
> 
> I would like to shorten this to
> 
> options={PlotStyle->RBGColor[1,0,0], Ticks->None}
> Plot[x^2, {x,0,1}, options]
> Plot[x^3, {x,0,1}, options]
> Plot[x^4, {x,0,1}, options]
> 

As usual there are many ways to achieve what you want and I have seen that
others have sent useful suggestions. Anyway I could not resist to present
the following, just because it looks like the whole Options mechanism is
there to do exactly what you want:

SetOptions[Plot, PlotStyle -> RGBColor[1, 0, 0], Ticks -> None]
Plot[x^2, {x, 0, 1}]
Plot[x^3, {x, 0, 1}]
Plot[x^4, {x, 0, 1}]

of course you might want to reset the options to their defaults, depending
on what follows. There is also a package in MathSource (BlockOptions) that
lets you temporarily SetOptions of symbols and does the cleanup
automatically, but I have never used it.

hth

albert


  • Prev by Date: Re: plotting data in a triangular domain
  • Next by Date: Re: Use of Mathematica with Rule-based Equation Derivations
  • Previous by thread: Re: list of options in Plot
  • Next by thread: Mean of skew-normal distribution