1

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.

benybenjamin
  • 103
  • 6

2 Answers2

1

RotateLabel is exclusively for Frame, not for Axes.

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

Szabolcs
  • 234,956
  • 30
  • 623
  • 1,263
  • Thanks. This only rotates the text, but I would also like to place the label besides the y-axis, not above it. – benybenjamin May 14 '18 at 14:44
  • 1
    @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. – Szabolcs May 14 '18 at 14:47
  • @benybenjamin Sorry, I just noticed that you already found it. – Szabolcs May 14 '18 at 14:49
1

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.

benybenjamin
  • 103
  • 6