7
$\begingroup$

Is it possible to set the font family to Arial for axes, legends and labels globally?

I found out about

SetOptions[
  Legending`GridLegend, 
  Legending`LegendContainer -> (Framed@ Append[#, FontFamily -> "Arial"] &)
];

for legends, but now I am trying to set the axis labels.

$\endgroup$
9
$\begingroup$

In addition to AxesStyle etc. which can be set for specific functions such as Plot with e.g. SetOptions[Plot, ...] there are more global FrontEnd settings by Box type. These are accessible in the Option Inspector:

Mathematica graphics

From here we can set options that apply to multiple plot functions, and in fact all Graphics objects that do not override the defaults. You can see in the screen shot that there are options for a variety of FrontEnd graphics Box types, and categories for "Graphics3D" and "Specific" Box Options as well.

You can also do this by command, e.g.:

SetOptions[$FrontEndSession,
  GraphicsBoxOptions -> {AxesStyle -> Directive[FontFamily -> "Arial"]}
]

Change $FrontEndSession to $FrontEnd to make the style persistent.

$\endgroup$
  • 1
    $\begingroup$ p.s. see also the documentation for DefaultAxesStyle, and other symbols in Names["Default*Style"]. $\endgroup$ – Mr.Wizard Sep 18 '12 at 19:14
6
$\begingroup$

Use AxesStyle with Directive

Plot[Sin[x], {x, -Pi, Pi}, AxesStyle -> Directive[Red, 15, FontFamily -> "Arial"]]

To set things globally, use SetOptions

 SetOptions[Plot, 
  AxesStyle -> Directive[Red, FontFamily -> "Arial"], 
  LabelStyle -> Directive[Blue, FontFamily -> "Arial"]];

Plot[Sin[x], {x, -Pi, Pi}, PlotLabel -> "my plot",AxesLabel -> {"x", "y"}]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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