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.

From the documentation:

Plot[2 Sin[x], {x, 0, 10}, Frame -> True, FrameLabel -> {x, y}, 
 PlotLabel -> 2 Sin[x], LabelStyle -> Orange]

enter image description here

But then add a frame style:

Plot[2 Sin[x], {x, 0, 10}, Frame -> True, FrameLabel -> {x, y}, 
 PlotLabel -> 2 Sin[x], FrameStyle -> Green, LabelStyle -> Orange]

enter image description here

To me this is unexpected. I thought FrameStyle controlled the frame style not the frame tick or frame label style (if explicit options had been entered for FrameTicksStyle and LabelStyle).

It is possible to separate the styles of the frame and the frame ticks (via FrameTicksStyle). I'm assuming I am missing something very obvious here but how can a user give separate the styles of the frame and the frame labels?

i.e. How can I create a plot with a blue frame and red frame labels?

(I know I can use Style when entering frame labels but I am seeking an answer in terms of plotting options -- if one exists.)

share|improve this question
1  
@J.M. ...and yet despite stating that both FrameTicksStyle and FrameStyle have a higher priority than LabelStyle, the explicit examples show that LabelStyle has a higher priority than FrameTicksStyle. I therefore wouldn't consider this part of the documentation to be enlightening :) –  Mike Honeychurch Jun 18 '12 at 7:52
1  
How are you defining higher priority? FrameTicksStyle supposed higher priority leaves labels unchanged whereas FrameStyle, also higher priority but it changes labels. If they are defined to have the same priority in relation to labels shouldn't they act the same? –  Mike Honeychurch Jun 18 '12 at 7:59
2  
Not pretty, but you can do something like Plot[2 Sin[x], {x, 0, 10}, Frame -> True, FrameLabel -> {x, y}, PlotLabel -> 2 Sin[x], FrameStyle -> Directive[Green, FontColor -> Orange], FrameTicksStyle -> Directive[FontColor -> Black], LabelStyle -> Orange] to have different styles for the frame labels, frame + ticks, and tick marks. –  Heike Jun 18 '12 at 8:49
1  
@Heike can you put that in an answer? It may not be pretty but is still easier than wrapping Style around all frame labels. –  Mike Honeychurch Jun 18 '12 at 8:52
1  
@MikeHoneychurch I've added my comment as an answer –  Heike Jun 18 '12 at 9:35
show 7 more comments

2 Answers

up vote 12 down vote accepted

As I mentioned in a comment, you can do something like this to have different styles for the frame, ticks, tick marks, plot label, and frame labels.

Plot[2 Sin[x], {x, 0, 10}, Frame -> True, FrameLabel -> {x, y}, 
 PlotLabel -> 2 Sin[x], 
 FrameStyle -> Directive[Green, FontColor -> Orange], 
 FrameTicksStyle -> Directive[Yellow, FontColor -> Black], 
 LabelStyle -> Purple]

Mathematica graphics

To style the text you can use other options as well such as FontSize, FontFamily, FontWeight etc., but the various options seem to inherit from each other, so setting for example FontSize -> 20 in LabelStyle will also set the size of the tick labels so you would need to set the FontSize in FrameTicksStyle to compensate.

Also, setting FontSize in LabelStyle doesn't seem influence the size of the PlotLabel. To change this you can use the BaseStyle option.

share|improve this answer
1  
+1 I forgot the FontColor option sooo many times –  belisarius Jun 18 '12 at 13:02
add comment

"How can I create a plot with a blue frame and red frame labels?"

You could use BaseStyle instead of FrameStyle, however this also colours the x axis.

Plot[2 Sin[x], {x, 0, 10}, Frame -> True, FrameLabel -> {x, y}, 
 PlotLabel -> 2 Sin[x], BaseStyle -> Blue, LabelStyle -> Red]

enter image description here

share|improve this answer
    
This then raises other issues when you want to set frame thickness and so on. So it doesn't really address the more general separation of label and frame style. –  Mike Honeychurch Jun 18 '12 at 11:44
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.