21
$\begingroup$

Is there a way to prevent ugly collision of axes labels and axes number like in the following examples, without the need of adding white space:

Plot1:

Plot3D[Sin[x] Cos[y], {x, -Pi, Pi}, {y, -Pi, Pi}, 
    AxesLabel -> {"ω", Subscript["E","F"], "Log[σ(ω)]"}, LabelStyle -> Directive[16]]

Plot1

To avoid this distant axes label "Log[$\sigma(\omega)]" one can rotate it, but then:

Plot2:

Plot3D[Sin[x]Cos[y],{x,-Pi,Pi},{y,-Pi,Pi},
    AxesLabel->{"ω",Subscript["E","F"],Rotate["Log[σ(ω)]",90 Degree]},
    LabelStyle->Directive[16]
]

Plot2

I cannot imagine that using a 2-dimensional column with one element "Log[σ(ω)]" and the other a blank square is the only solution to cure Plot2. Is there a nice solution to prevent such an overlay?

$\endgroup$

1 Answer 1

25
$\begingroup$

You could specify the option ImageSize ->600 (or something large enough to you taste). However, that would change the proportions of other parts of the plot, and you may not want that.

So instead I'd suggest adding some offset around the labels by using Framed as follows:

Plot3D[Sin[x] Cos[y], {x, -Pi, Pi}, {y, -Pi, Pi}, 
 AxesLabel -> {"ω", Subscript["E", "F"], 
   Framed["Log[σ(ω)]", 
    FrameStyle -> None, 
    FrameMargins -> 20
   ]}, 
 LabelStyle -> Directive[16]
]

framed

To see what this does in more detail, you could leave out the option FrameStyle -> None, or add the option Background -> Yellow to the Framed command.

$\endgroup$
3
  • $\begingroup$ Congrats on your 10K! $\endgroup$ Jun 26, 2012 at 21:53
  • $\begingroup$ @SjoerdC.deVries Thanks - you're almost there too! BTW, how many points do we need in order to win a prize? $\endgroup$
    – Jens
    Jun 26, 2012 at 22:04
  • $\begingroup$ Enough to beat Jon Skeet. $\endgroup$ Jun 26, 2012 at 22:08

Your Answer

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

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