fig, ax = plt.subplots()
im = ax.imshow(a, interpolation='none')
cb = plt.colorbar(im)
for t in cb.ax.get_yticklabels():
    t.set_horizontalalignment('right')
t.set_x(3.5)
Align ticklabels in matplotlib colorbar