8.12 Changing the Appearance of Axis Labels

8.12.1 Problem

You want to change the appearance of axis labels.

8.12.3 Discussion

For the y-axis label, it might also be useful to display the text unrotated, as shown in Figure 8.23 (left). The \n in the label represents a newline character:

When you call element_text(), the default angle is 0, so if you set axis.title.y but don’t specify the angle, it will show in this orientation, with the top of the text pointing up. If you change any other properties of axis.title.y and want it to be displayed in its usual orientation, rotated 90 degrees, you must manually specify the angle (Figure 8.23, right):

Y-axis label with angle = 0 (left); With angle = 90 (right)Y-axis label with angle = 0 (left); With angle = 90 (right)

Figure 8.23: Y-axis label with angle = 0 (left); With angle = 90 (right)

8.12.4 See Also

See Recipe 9.2 for more about controlling the appearance of the text.