3
$\begingroup$

I need to plot a graph using two different colors for the axis labels.

Not working example:

Plot[Sin[x], {x, 0, 2 π}, Frame -> True, LabelStyle -> {{Red, Black}}]

Any comment is welcome.

$\endgroup$

1 Answer 1

4
$\begingroup$

You can use FrameStyle or FrameTicksStyle with suboptions FontColor, FontSize etc. :

Plot[Sin[x], {x, 0, 2 \[Pi]}, Frame -> True, 
 PlotLabel -> Style["plot label", 22, "Subsection", Purple],
 FrameStyle -> {{Directive[FontColor -> Red, FontFamily -> "Arial", FontSize -> 16],  Automatic}, 
  {Directive[FontColor -> Green, FontFamily -> "Calibri", FontSize -> 20], Automatic}}]

enter image description here

We get the same output using FrameTicksStyle instead of FrameStyle:

FrameTicksStyle -> 
 {{Directive[FontColor -> Red, FontFamily -> "Arial", FontSize -> 16], Automatic}, 
  {Directive[FontColor -> Green, FontFamily -> "Calibri",  FontSize -> 20], Automatic}}

You can also use the alternative syntax FrameStyle ->{bottomstyle, leftstyle, topstyle, rightstyle} to get the same output:

FrameStyle -> {Directive[FontColor -> Green, FontFamily -> "Calibri", FontSize -> 20], 
               Directive[FontColor -> Red, FontFamily -> "Arial", FontSize -> 16], 
               Automatic, Automatic}]

Similarly, for FrameTicksStyle.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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