7

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.

Karsten W.
  • 1,383
  • 8
  • 21

2 Answers2

9

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.

Mr.Wizard
  • 271,378
  • 34
  • 587
  • 1,371
6

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

Nasser
  • 143,286
  • 11
  • 154
  • 359