I would like to rotate the colorbar tick labels so that they read vertically rather than horizontally. I have tried as many variations as I can think of with cbar.ax.s
If you're happy with tick locations and labels and only want to rotate them:
cbar.ax.set_xticklabels(cbar.ax.get_xticklabels(), rotation='vertical')
You can use cbar.ax.set_xticklabels
to change the rotation (or set_yicklabels
if you had a vertical colorbar).
cbar.ax.set_xticklabels(clevs1[::1],rotation=90)
EDIT:
To set the ticks correctly, you can search for where in your clevs1
array the first tick should be using np.argmin
, and use that to index clevs1
when you set_xticklabels
:
tick_start = np.argmin(abs(clevs1-clevs[0]))
cbar.ax.set_xticklabels(clevs1[tick_start:],rotation=90)