problems with pcolormesh

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.

George,

Thanks for the report. I will try to get those problems cleared up this weekend.

Eric

George Nurser wrote:

···

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.

-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=k&kid0709&bid&3057&dat1642
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users