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$
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.

|improve this answer|||||
$\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.