File tree Expand file tree Collapse file tree 1 file changed +19
-6
lines changed
Expand file tree Collapse file tree 1 file changed +19
-6
lines changed Original file line number Diff line number Diff line change 11"""
2- ===========================
3- Rotating custom tick labels
4- ===========================
5-
6- Demo of custom tick-labels with user-defined rotation.
2+ ====================
3+ Rotating tick labels
4+ ====================
75"""
86
97import matplotlib .pyplot as plt
1412
1513fig , ax = plt .subplots ()
1614ax .plot (x , y )
17- # You can specify a rotation for the tick labels in degrees or with keywords.
15+ # A tick label rotation can be set using Axes.tick_params.
16+ ax .tick_params ("y" , rotation = 45 )
17+ # Alternatively, if setting custom labels with set_xticks/set_yticks, it can
18+ # be set at the same time as the labels.
19+ # For both APIs, the rotation can be an angle in degrees, or one of the strings
20+ # "horizontal" or "vertical".
1821ax .set_xticks (x , labels , rotation = 'vertical' )
1922
2023plt .show ()
24+
25+ # %%
26+ #
27+ # .. admonition:: References
28+ #
29+ # The use of the following functions, methods, classes and modules is shown
30+ # in this example:
31+ #
32+ # - `matplotlib.axes.Axes.tick_params` / `matplotlib.pyplot.tick_params`
33+ # - `matplotlib.axes.Axes.set_xticks` / `matplotlib.pyplot.xticks`
You can’t perform that action at this time.
0 commit comments