When I plot a contourf
with uneven contour levels, the colorbar displays evenly-sized color areas. I'd like to adjust the heights of these color areas so that they scale with the steps in countourf
levels. More generally, is there a simple way to adjust these heights arbitrarily?
Example code:
from pylab import *
figure(figsize = (4,3.3))
xi, yi = meshgrid(linspace(-1,1), linspace(-1,1))
zi = exp(-xi**2+yi)
zi -= zi.min()
zi /= zi.max()
contourf(xi, yi, zi, levels = [0, .2, .6, 1])
colorbar()
show()