I am using the following snippet to create a custom colorbar:
import pylab as pl
import numpy as np
a = np.array([[0,10000,100000,400000,500000]])
pl.figure(figsize=(9, 1.5))
mycmap = colors.ListedColormap(['yellow','orange','red','darkred'])
img = pl.imshow(a, cmap=mycmap)
pl.gca().set_visible(False)
cax = pl.axes([0.1, 0.2, 0.8, 0.6])
cbar=pl.colorbar(orientation='horizontal', cax=cax,spacing='proportional');
cbar.set_ticks([0,10000,100000,400000,500000])
cbar.set_ticklabels(['0','10000','100000','400000','500000'])
This is giving me a colorbar with regular intervals, although I have specified spacing='proportional':

The intended result is, instead:
0-10000: yellow
10001-100000: orange
100001-400000: red
400001-500000: dark red
What am I doing wrong?

