If you want to apply rotation on the axes object, the easiest way is using tick_params
. For example.
ax.tick_params(axis='x', labelrotation=90)
Matplotlib documentation reference here.
This is useful when you have an array of axes as returned by plt.subplots
, and it is more convenient than using set_xticks
because in that case you need to also set the tick labels, and also more convenient that those that iterate over the ticks (for obvious reasons)