Colorbar does not show values when using LogNorm()
Question: I am trying to make a contour plot with the contour levels scaled by the log
of the values. However, the colorbar does not show enough values next to the
colors. Here is a simple example.

    
    
    import numpy as N
    import matplotlib as M
    import matplotlib.pyplot as PLT
    
    # Set up a simple function to plot 
    values = N.empty((10,10))
    for xi in range(10):
        for yi in range(10):
            values[xi,yi] = N.exp(xi*yi/10. - 1)
    
    levels = N.logspace(-1, 4, 10)
    log_norm = M.colors.LogNorm() 
    # Currently not used - linear scaling
    linear_norm = M.colors.Normalize()
    
    # Plot the function using the indices as the x and y axes
    PLT.contourf(values, norm=log_norm, levels=levels)
    PLT.colorbar()
    

If you switch log_norm for linear_norm in the contourf call, you'll see that
the colorbar does have values. Of course, using linear_norm means the colors
are scaled linearly and the contours are not well distributed for this
function.

I'm using python 2.7.2, enthought edition which comes with matplotlib, on Mac
OS 10.7.


Answer: Add a format to the call to `PLT.colorbar`:

    
    
    import numpy as N
    import matplotlib as M
    import matplotlib.pyplot as PLT
    
    # Set up a simple function to plot 
    x,y = N.meshgrid(range(10),range(10))
    values = N.exp(x*y/10. - 1)
    
    levels = N.logspace(-1, 4, 10)
    log_norm = M.colors.LogNorm() 
    # Currently not used - linear scaling
    linear_norm = M.colors.Normalize()
    # Plot the function using the indices as the x and y axes
    PLT.contourf(values, norm=log_norm, levels=levels)
    PLT.colorbar(format='%.2f')
    PLT.show()
    

![enter image description here](http://i.stack.imgur.com/kuD9d.png)

