sudden problem with basemap and plt.colorbar()

Hello, I've been using basemap with plt.colorbar for sometime, but I
just recently started to have the problem of:
AttributeError: 'NoneType' object has no attribute 'autoscale_None'

I ran the fcstmaps.py example (GREAT EXAMPLE by the way), and here is
the full error I get:

Traceback (most recent call last):
  File "fcstmaps.py", line 92, in <module>
    plt.colorbar(cax=cax, orientation='horizontal')
  File "/matplotlib/pyplot.py", line 1519, in colorbar
    ret = gcf().colorbar(mappable, cax = cax, ax=ax, **kw)
  File "/matplotlib/figure.py", line 1180, in colorbar
    cb = cbar.Colorbar(cax, mappable, **kw)
  File "/matplotlib/colorbar.py", line 706, in __init__
    mappable.autoscale_None() # Ensure mappable.norm.vmin, vmax
AttributeError: 'NoneType' object has no attribute 'autoscale_None'

I did upgrade matplotlib recently to version 1.0.0

Basemap is 0.99.4

Thanks,
john

John,

It appears the problem is in matplotlib, somehow… Could you verify which version of matplotlib is actually being loaded by executing the following commands in python?

import matplotlib

print matplotlib.version

Currently, in version 1.0.0, the beginning of the pyplot.colorbar() function checks to see if mappable is None. If not, then sets mappable to gci(). So, either you are running an older code that did not do this, or gci() is returning a None, which is curious…

Ben Root

···

On Thu, Oct 28, 2010 at 3:16 PM, John <washakie@…287…> wrote:

Hello, I’ve been using basemap with plt.colorbar for sometime, but I

just recently started to have the problem of:

AttributeError: ‘NoneType’ object has no attribute ‘autoscale_None’

I ran the fcstmaps.py example (GREAT EXAMPLE by the way), and here is

the full error I get:

Traceback (most recent call last):

File “fcstmaps.py”, line 92, in

plt.colorbar(cax=cax, orientation='horizontal')

File “/matplotlib/pyplot.py”, line 1519, in colorbar

ret = gcf().colorbar(mappable, cax = cax, ax=ax, **kw)

File “/matplotlib/figure.py”, line 1180, in colorbar

cb = cbar.Colorbar(cax, mappable, **kw)

File “/matplotlib/colorbar.py”, line 706, in init

mappable.autoscale_None() # Ensure mappable.norm.vmin, vmax

AttributeError: ‘NoneType’ object has no attribute ‘autoscale_None’

I did upgrade matplotlib recently to version 1.0.0

Basemap is 0.99.4

Thanks,

john

Seems upgrading basemap to V 1.0 has solved it. So now I have:

In [1]: import mpl_toolkits.basemap as Basemap
In [2]: Basemap.__version__
Out[2]: '1.0'
In [3]: import matplotlib as mpl
In [4]: mpl.__version__
Out[4]: '1.0.0'

And the tutorial runs smoothly.

--john

···

On Thu, Oct 28, 2010 at 10:30 PM, Benjamin Root <ben.root@...1304...> wrote:

On Thu, Oct 28, 2010 at 3:16 PM, John <washakie@...287...> wrote:

Hello, I've been using basemap with plt.colorbar for sometime, but I
just recently started to have the problem of:
AttributeError: 'NoneType' object has no attribute 'autoscale_None'

I ran the fcstmaps.py example (GREAT EXAMPLE by the way), and here is
the full error I get:

Traceback (most recent call last):
File "fcstmaps.py", line 92, in <module>
plt.colorbar(cax=cax, orientation='horizontal')
File "/matplotlib/pyplot.py", line 1519, in colorbar
ret = gcf().colorbar(mappable, cax = cax, ax=ax, **kw)
File "/matplotlib/figure.py", line 1180, in colorbar
cb = cbar.Colorbar(cax, mappable, **kw)
File "/matplotlib/colorbar.py", line 706, in __init__
mappable.autoscale_None() # Ensure mappable.norm.vmin, vmax
AttributeError: 'NoneType' object has no attribute 'autoscale_None'

I did upgrade matplotlib recently to version 1.0.0

Basemap is 0.99.4

Thanks,
john

John,

It appears the problem is in matplotlib, somehow... Could you verify which
version of matplotlib is actually being loaded by executing the following
commands in python?

import matplotlib
print matplotlib.__version__

Currently, in version 1.0.0, the beginning of the pyplot.colorbar() function
checks to see if mappable is None. If not, then sets mappable to gci().
So, either you are running an older code that did not do this, or gci() is
returning a None, which is curious...

Ben Root

--
Configuration
``````````````````````````
Plone 2.5.3-final,
CMF-1.6.4,
Zope (Zope 2.9.7-final, python 2.4.4, linux2),
Python 2.6
PIL 1.1.6
Mailman 2.1.9
Postfix 2.4.5
Procmail v3.22 2001/09/10
Basemap: 0.99.4
Matplotlib: 1.0.0