Note
Go to the endto download the full example code.
Rotated tick labels#
importmatplotlib.pyplotaspltx=[1,2,3,4]y=[1,4,9,6]labels=['Frogs','Hogs','Bogs','Slogs']fig,ax=plt.subplots()ax.plot(x,y)# A tick label rotation can be set using Axes.tick_params.ax.tick_params("y",rotation=45)# Alternatively, if setting custom labels with set_xticks/set_yticks, it can# be set at the same time as the labels.# For both APIs, the rotation can be an angle in degrees, or one of the strings# "horizontal" or "vertical".ax.set_xticks(x,labels,rotation='vertical')plt.show()

References
The use of the following functions, methods, classes and modules is shownin this example: