Chech this example:
SetOptions[Plot,ImagePadding -> {{50, 30}, {Automatic, Automatic}}];
Options[Plot, ImagePadding]
(*{ImagePadding -> {{50, 30}, {Automatic, Automatic}}}*)
SetOptions[Grid, Dividers -> All, Alignment -> Left];
Options[Grid, {Alignment, Dividers}]
(*{Alignment -> Left, Dividers -> All}*)
Grid[{{Plot[{Sin[x], Cos[x]}, {x, 0, 2},
PlotLegends -> "Expressions"]}, {Plot[Exp[x], {x, 0, 10}]}}]
However this works fine:
Grid[{{Plot[{Sin[x], Cos[x]}, {x, 0, 2},
PlotLegends -> "Expressions"]}, {Plot[Exp[x], {x, 0, 10}]}},
Alignment -> Left, Dividers -> All]
Any idea why and any solutions?
Thanks
SetOptions
should in fact never be used, because it redefines the option values in a global way (which means that two different applications using it may easily conflict with each other without knowing it). You can pass options locally, and it should always work and is much safer. I have discussed a solution that would emulate stateful option changes (and make this convenient), while still passing them locally, here and here. $\endgroup$SetOptions
, in terms of setting it once and then just using it, while would be much safer and also would always work (SetOptions
is known to not work properly on some functions). Re: app conflict - well, imagine two apps which are used intermittently and both set some option to the same built-in function, but in a different way. Then, unless they callSetOptions
in every function they provide, chances are that at least one such app will not work properly. $\endgroup$