Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

This question already has an answer here:

If I plot many graphs with some standard set of options. Is there a way to store this set so that i can have better overview/structure over my plotting commands?

example, I plot a function f[x] with a set of options:

Plot[f[x], {x, 0, 1}, PlotRange -> All, Axes -> False, Frame -> True,
    PlotStyle ->Black, LabelStyle -> Directive[FontFamily -> "Symbol"], 
    FrameStyle -> AbsoluteThickness@1, BaseStyle -> {PrivateFontOptions ->
    {"OperatorSubstitution" -> False}}, AspectRatio -> 0.5/GoldenRatio, ImageSize -> 226]

I would like to reduce the above to something like:

plotoptions1={PlotRange -> All, Axes -> False, Frame -> True, 
     PlotStyle -> Black, LabelStyle -> Directive[FontFamily -> "Symbol"], 
     FrameStyle -> AbsoluteThickness@1, BaseStyle -> {PrivateFontOptions ->
     {"OperatorSubstitution" -> False}}, AspectRatio -> 0.5/GoldenRatio, ImageSize -> 226}

and then make a graph:

Plot[f[x], {x, 0, 1}, plotoptions1]

This structure does not work, I get the error:

Plot::nonopt: "Options expected (instead of plotoptions1) beyond position 3 in 
Plot[f[x], {x, 0, 1}, plotoptions1]. An option must be a rule or a list of rules"

But I thought plotoptions1 was a list of rules, so what should I do?

share|improve this question

marked as duplicate by rm -rf Mar 13 at 17:34

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2 Answers 2

up vote 3 down vote accepted
opts = {PlotRange -> All, Axes -> False, Frame -> True, 
  PlotStyle -> Red, LabelStyle -> Directive[FontFamily -> "Symbol"], 
  FrameStyle -> AbsoluteThickness@1, 
  BaseStyle -> {PrivateFontOptions -> {"OperatorSubstitution" ->   False}}, 
  AspectRatio -> 0.5/GoldenRatio,  ImageSize -> 226};

Plot[Sin@x, {x, 0, 1}, Evaluate[opts]]

Mathematica graphics

share|improve this answer

You can also use the SetOptions function to change the default option settings for any function/symbol:

SetOptions[Plot, PlotRange -> All, Axes -> False, Frame -> True,
  PlotStyle -> Black, LabelStyle -> Directive[FontFamily -> "Symbol"],
   FrameStyle -> AbsoluteThickness@1, 
  BaseStyle -> {PrivateFontOptions -> {"OperatorSubstitution" -> 
       False}}, AspectRatio -> 0.5/GoldenRatio, ImageSize -> 226];

Plot[Sin[x], {x, 0, 1}]
share|improve this answer
    
Ok, but then you have defined only one style. I would like to define a few standard styles. –  Sander Mar 13 at 17:05

Not the answer you're looking for? Browse other questions tagged or ask your own question.