# How can I define an option “packet” for plots so I can only alter the definition and all plots with that “packet” will change appearance? [duplicate]

Possible Duplicate:
Consistent Plot Styles across multiple MMA files and data sets

So, here's my problem; I have a lot of data that is shown in different plots. I want all the plots to have the same options (PlotStyle, Axes, BaseStyle, FrameTicks, etc...). I also want to be able to modify these options (because the size and FontSize change depending on where I want to use the plots, in my thesis or in a presentation) and do that without having to change each Plot function by hand.

I guess what I'm looking for is something like this:

optionPacket = PlotStyle -> {RGBColor[1, 0, 0]}, Frame -> True,
BaseStyle -> {FontSize -> 20};


and then use it like this:

ListPlot[mydata, optionPacket]

ListPlot[mydata2, optionPacket]


Is there any way to accomplish this? (What I just posted obviously doesn't work or I wouldn't be asking).

-

## marked as duplicate by rm -rf♦Nov 9 '12 at 16:18

You can define optionPacket = {RGBColor[1, 0, 0], Frame -> True, BaseStyle -> {FontSize -> 20}}; and then do Plot[Sin[x], {x, -1, 1}, PlotStyle -> optionPacket]. Notice your syntax is incorrect. –  b.gatessucks Nov 9 '12 at 12:26
@freda Welcome to the Mathematica StackExchange! We recommend that you register your account so you can easily keep track of answers and comments to your question. The following question (mathematica.stackexchange.com/questions/3247) possibly answers yours. –  tkott Nov 9 '12 at 15:53
Freda, I agree with tkott — this question was asked previously and has received good answers that address your question. –  rm -rf Nov 9 '12 at 16:19

Use Sequence[] for the purpose:

optionPacket = Sequence[PlotStyle -> {RGBColor[1, 0, 0]}, Frame -> True,
BaseStyle -> {FontSize -> 20}]

{ListPlot[RandomVariate[NormalDistribution[], {7, 2}], optionPacket],
ListPlot[RandomVariate[WeibullDistribution[1, 2], {7, 2}], optionPacket]} // GraphicsRow


Szabolcs mentions that you can also use a plain list for the purpose, so

optionPacket = {PlotStyle -> {RGBColor[1, 0, 0]}, Frame -> True,
BaseStyle -> {FontSize -> 20}}


works just as well.

-
Actually you can just use a plain List of options, there's no need for Sequence. I saw this in the Visualizaion QA and I was a bit surprised it was possible. Perhaps it's worth mentioning in the answer, it's more newbie-friendly than Sequence –  Szabolcs Nov 9 '12 at 15:42
@Szabolcs: Hmm, interesting. I remember a time when one couldn't pass a list of options (which was why the old FilterOptions[] produced a Sequence[] object as output)... –  Ｊ. Ｍ. Nov 9 '12 at 15:45
I wouldn't expect this to work with all functions, but it does seem to work with Graphics and several (all?) plotting functions. OptionsPattern and related functions seem to handle it too. –  Szabolcs Nov 9 '12 at 15:46

SetOptions[Plot, PlotStyle -> {RGBColor[1, 0, 0], Frame -> True, BaseStyle -> {FontSize -> 20}}]

ParametricPlot[{x, Sin[x]}, {x, -1, 1}]