I can set the Options for Plot as:

  AxesStyle -> 
 {{Black, 14, Italic, FontFamily -> "Times"}, 
 {Black, 14, Italic, FontFamily -> "Times"}}];

But it also changes the style on the labels themselves (which I want in a different style), e.g., "x" and "y" in this example:

 {x, -5, 5},
 AxesLabel -> {"x", "y"}]

How can I set the Options for the added labels to be separate from the rest of the AxesStyle? As an example, suppose I want the "x" and "y" to be Red, Bold, and 28 points?

Of course I can hand code those styles each time into the AxesLabel specifications, but I'd like to do it with Options.

  • $\begingroup$ Add the options FontColor -> Red, FontWeight -> Bold when you set AxesStyle? $\endgroup$ – kglr Dec 19 '19 at 2:41
  • $\begingroup$ @kglr: Nope. Doesn't work: It makes all the text red. And note that I want the size of the axes ticks to be different from the "x" and "y" labels too. $\endgroup$ – David G. Stork Dec 19 '19 at 2:43
  • $\begingroup$ sorry; i see... $\endgroup$ – kglr Dec 19 '19 at 2:45
  • $\begingroup$ maybe add the option TicksStyle -> FontColor -> Black to override the FontColor ->Red in set in AxesStyle? $\endgroup$ – kglr Dec 19 '19 at 2:49
  • $\begingroup$ @kglr: You set me on the right track; override was the key. SetOptions[Plot, Sequence[ AxesStyle -> {{28, Italic, FontFamily -> "Times", FontColor -> Red}, {28, Italic, FontFamily -> "Times", FontColor -> Red}}], TicksStyle -> {{14, FontColor -> Black}, {14, FontColor -> Black}}]; Post that and I'll accept it. $\endgroup$ – David G. Stork Dec 19 '19 at 2:53

You can override the font settings given in AxesStyle using TicksStyle:

  {AxesStyle -> Directive[28, Italic, FontFamily -> "Times", FontColor -> Red], 
   TicksStyle -> Directive[14, FontColor -> Black]}]

Plot[Sin[x], {x, 0, 2 Pi}, AxesLabel -> {"X", "Y"}]

enter image description here

| improve this answer | |
  • 1
    $\begingroup$ I really do dislike how TicksStyle is misnamed... it's really more like TickLabelStyle. $\endgroup$ – b3m2a1 Dec 19 '19 at 8:32

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.