from pylab import *

class LogNorm(matplotlib.colors.normalize):
     """
     Normalize on a log scale.
     """
     def __init__(self,vmin=None, vmax=None, clip = True):
         matplotlib.colors.normalize.__init__(self,vmin=log(vmin),vmax=log(vmax),clip=clip)
     
     def __call__(self, value):
         return matplotlib.colors.normalize.__call__(self, log(value))


delta = 0.025
x = arange(-3.0, 3.0, delta)
y = arange(-2.0, 2.0, delta) 

X, Y = meshgrid(x, y)

# A low hump with a spike coming out of the top right. 
# Needs to have z/colour axis on a log scale so we both hump and spike.
# linear scale only shows the spike.
Z1 = bivariate_normal(X, Y, 0.1, 0.2, 1.0, 1.0) + 0.1*bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)

pcolor(X,Y,Z1,shading='flat',norm=LogNorm(vmin=Z1.min(),vmax=Z1.max()))

colorbar()

#show()
savefig('pcolor_log.png')
