Rotate tick labels in subplot

You can do it in multiple ways:

Here is one solution making use of tick_params:

ax.tick_params(labelrotation=45)

Here is another solution making use of set_xticklabels:

ax.set_xticklabels(labels, rotation=45)

Here is a third solution making use of set_rotation:

for tick in ax.get_xticklabels():
    tick.set_rotation(45)

Leave a Comment