We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ef8e524 commit 203af57Copy full SHA for 203af57
1 file changed
galleries/examples/ticks/ticklabels_rotation.py
@@ -7,6 +7,9 @@
7
Adjust the tick properties using `~.Axes.tick_params`: Set the angle in degrees via
8
the *rotation* parameter. Set the *rotation_mode* parameter to "xtick" / "ytick" to
9
make the text point towards the tick, see also `~.Text.set_rotation_mode`.
10
+
11
+Note: We use ``layout="constrained"`` to make sure there is enough space for the tick
12
+labels so that they are not cut off.
13
"""
14
15
import matplotlib.pyplot as plt
@@ -30,7 +33,7 @@
30
33
'Vietnam': 102.3,
31
34
}
32
35
-fig, ax = plt.subplots()
36
+fig, ax = plt.subplots(layout="constrained")
37
ax.bar(population.keys(), population.values())
38
ax.tick_params("x", rotation=45, rotation_mode="xtick")
39
ax.set_ylabel("population (millions)")
0 commit comments