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.

In Mathematica 8, I can use GraphicsBoxOptions->{DefaultBaseStyle->{"Graphics", FontFamily -> "Helvetica", FontSize -> 14}} to specify the default font for graphics. But this does not work for Mathematica 9. How to specify the default style in Mathematica 9 then?

Using BaseStyle may be a solution. But it is not generalizable to other default styles like DefaultAxesStyle, DefaultFrameStyle etc. Originally DefaultAxesStyle->{"GraphicsAxes", FontSize -> 12} works in Mathematica 8, but it runs into error in Mathematica 9 (message: The specified setting for the option GraphicsBoxOptions, DefaultAxesStyle cannot be used). Does anyone know about the style specification grammar in Mathematica 9?

share|improve this question
add comment

1 Answer 1

You can set all sorts of options to Graphics using the SetOptions command:

SetOptions[Graphics, 
 BaseStyle -> {FontFamily -> "Helvetica", FontSize -> 16}, 
 AxesStyle -> Directive[Red, Thick]]

The output from this command will show you some other options that you can set. Here I've just set the font style and axes style; FrameStyle can be added as you wish.

(*{AlignmentPoint -> Center, AspectRatio -> Automatic, Axes -> False, 
 AxesLabel -> None, AxesOrigin -> Automatic, 
 AxesStyle -> Directive[RGBColor[1, 0, 0], Thickness[Large]], 
 Background -> None, BaselinePosition -> Automatic, 
 BaseStyle -> {FontFamily -> "Helvetica", FontSize -> 16}, 
 ColorOutput -> Automatic, ContentSelectable -> Automatic, 
 CoordinatesToolOptions -> Automatic, 
 DisplayFunction :> $DisplayFunction, Epilog -> {}, 
 FormatType :> ( ##1 &), Frame -> False, FrameLabel -> None, 
 FrameStyle -> {}, FrameTicks -> Automatic, FrameTicksStyle -> {}, 
 GridLines -> None, GridLinesStyle -> {}, ImageMargins -> 0., 
 ImagePadding -> All, ImageSize -> Automatic, 
 ImageSizeRaw -> Automatic, LabelStyle -> {}, Method -> Automatic, 
 PlotLabel -> None, PlotRange -> All, PlotRangeClipping -> False, 
 PlotRangePadding -> Automatic, PlotRegion -> Automatic, 
 PreserveImageOptions -> Automatic, Prolog -> {}, RotateLabel -> True,
  Ticks -> Automatic, TicksStyle -> {}} *)

This shows that it works:

Graphics[Text["this is a test", {0.5, 0.5}], Axes -> True, 
 ImageSize -> 150]

enter image description here

share|improve this answer
    
Thanks for your solution. It solve part of the problem. I also want to modify DefaultAxesStyle and DefaultFrameStyle etc. Do you know how to write the style specification in Mathematica 9? –  Everett You Jan 17 '13 at 4:45
    
Does this work for all things such as Plot that produce GraphicsBox FE objects or only Graphics created directly? –  Mr.Wizard Jan 17 '13 at 7:34
1  
@Mr.Wizard This only works for Graphics created directly. Mike Honeychurch has a great answer here. –  Szabolcs Nov 11 '13 at 12:51
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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