I've noticed a few problems with pcolormesh, running r 2341
interactively from ipython -pylab, TkAgg, with from numpy import *
1. colorbar() won't draw.
a=rand(10,10)
pcolormesh(a)
colorbar()
throws error:
···
---------------------------------------------------------------------------
exceptions.AttributeError Traceback (most
recent call last)
/users/mod/agn/<ipython console>
/data/jrd/mod1/agn/ext/Linux/lib64/python/matplotlib/pylab.py in
colorbar(mappable, cax, orientation, tickfmt, cspacing, clabels,
drawedges, edgewidth, edgecolor)
390 drawedges=drawedges,
391 edgewidth=edgewidth,
--> 392 edgecolor=edgecolor)
393 draw_if_interactive()
394 return ret
/data/jrd/mod1/agn/ext/Linux/lib64/python/matplotlib/figure.py in
colorbar(self, mappable, cax, orientation, tickfmt, cspacing, clabels,
drawedges, edgewidth, edgecolor)
712 ax = self.gca()
713
--> 714 cmap = mappable.cmap
715
716 if cax is None:
AttributeError: 'NoneType' object has no attribute 'cmap'
bug can be sidestepped by
pp=pcolormesh(a)
colorbar(mappable=pp)
though this is a bit obscure.
2. More seriously, two problems with masked arrays.
e.g.
b = ma.maskarray(a<0.5,a)
pp=pcolormesh(b,norm=normalize(clip=False))
i. masked squares come out grey (nstead of white with pcolor).
ii. any further resize screws up plot -- old plot hasn't been deleted properly
e.g.
colorbar(mappable=pp)
gives overlay of two plots.
No way round (i), though it's not a disaster; for (ii) need to get
size right first time!
--George.