Is it possible to assign a couple of Plot
options like e.g.
Frame -> True, PlotRange -> All, ImageSize -> 500
to a variable so that I can use it instead of repeating all options in my next plot?
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.
Sign up to join this communityFirst of all, one should mention that it is possible to define a custom PlotTheme
:
Second, something like @Henrik Schumacher's suggestion is possible, but (1) you need to use Evaluate
and (2) one can use a simple List
instead of Sequence
, which makes combining and adding options somewhat easier.
A couple of examples:
myPlotOpts = {Frame -> True, PlotRange -> All, ImageSize -> 500};
Plot[Sin[x], {x, -6, 6}, Evaluate@myPlotOpts]
It combines with other options without having to worry about the list structure:
Plot[Sin[x], {x, -6, 6}, PlotStyle -> Red, Evaluate@myPlotOpts]
SetOptions[{Plot}, Frame -> True, PlotRange -> All, ImageSize -> 500]
see SetOptions $\endgroup$opts = Sequence[Frame->True,PlotRange->All,ImageSize->500 ]
should be possible. $\endgroup$