1
$\begingroup$

I want to generate a plot with the label of the vertical axis rotated by 90 degree in order to save space. I cannot make that work with the option RotateLabel. Here is a MWE:

Graphics[Plot[x, {x, 0, 2}, AxesLabel -> {"x", "y"}], RotateLabel -> True]

According to the Mathematica documentation RotateLabel is a Graphics option that should also be working with Plot or ListPlot.

Any help appreciated. Thanks.

$\endgroup$
  • 1
    $\begingroup$ I always thought that this option is automatically used in the funcltions like Plot if the option Frame->True is used. So the label is rotated by default, but if it should not be rotated, use RotateLabel->False. $\endgroup$ – Alexei Boulbitch May 14 '18 at 13:00
  • 1
    $\begingroup$ I'd use AxesLabel -> {"x", Rotate["y", Pi/2]}. $\endgroup$ – b.gates.you.know.what May 14 '18 at 13:14
1
$\begingroup$

RotateLabel is exclusively for Frame, not for Axes.

As a workaround, you can rotate any piece of text using Rotate before rendering it.

$\endgroup$
  • $\begingroup$ Thanks. This only rotates the text, but I would also like to place the label besides the y-axis, not above it. $\endgroup$ – benybenjamin May 14 '18 at 14:44
  • 1
    $\begingroup$ @benybenjamin Then the best solution is to use a Frame. Note that you can turn on and off the four frame borders independently. You can keep only the left and bottom ones for an axes-like look. $\endgroup$ – Szabolcs May 14 '18 at 14:47
  • $\begingroup$ @benybenjamin Sorry, I just noticed that you already found it. $\endgroup$ – Szabolcs May 14 '18 at 14:49
0
$\begingroup$

I've found the answer here.

This works for my example:

Plot[x, {x, 0, 2}, Axes -> False, Frame -> {{True, False}, {True, False}}, FrameLabel -> {{"a very long label for the y-axis", None}, {"x", None}}, FrameTicks -> All]

Thanks.

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