a = np.random.randn(10, 10)
fig, ax = plt.subplots()
im = ax.imshow(a, interpolation='none')
cb = plt.colorbar(im)
ticklabs = cb.ax.get_yticklabels()
cb.ax.set_yticklabels(ticklabs, ha='right')
cb.ax.yaxis.set_tick_params(pad=45)
Align ticklabels in matplotlib colorbar