Strange behavior for lognorm colorbar with extend as both


Hi,
I met with a problem using Python to draw graphs. Compare the following two scripts and attached graphs. For the first one, the left edge of the colorbar is white. It seems that only when I use norm=LogNorm() the problem happens. Does anyone know how to solve it?
Thanks!
python1:
from mpl_toolkits.basemap import cm
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.colors import LogNorm
data = np.tile(np.logspace(-12,0,num=13),(13,1))
print data[0]
bounds = data[0][2:-2]
print bounds
fig,ax=plt.subplots()
im = ax.imshow(data,vmin=bounds[0],vmax=bounds[-1],norm=LogNorm(),cmap = cm.GMT_seis_r)
cb=fig.colorbar(im,ax=ax,\
extend='both',\
ticks=bounds,\
#default, can be omitted
drawedges=False,\
shrink=0.6,\
orientation='horizontal',\
pad=0.02)
plt.show()
python2:
from mpl_toolkits.basemap import cm
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.colors import LogNorm
data = np.tile(np.arange(-12,0),(13,1))
print data[0]
bounds = data[0][2:-2]
print bounds
fig,ax=plt.subplots()
im = ax.imshow(data,vmin=bounds[0],vmax=bounds[-1],cmap = cm.GMT_seis_r)
cb=fig.colorbar(im,ax=ax,\
extend='both',\
ticks=bounds,\
#default, can be omitted
drawedges=False,\
shrink=0.6,\
orientation='horizontal',\
pad=0.02)
plt.show()

Chao

···


Chao YUE
Laboratoire des Sciences du Climat et de l’Environnement (LSCE-IPSL)
UMR 1572 CEA-CNRS-UVSQ
Batiment 712 - Pe 119
91191 GIF Sur YVETTE Cedex

Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16