Basemap calls to colorbar() failing

Jeff,

Right now, for me, any Basemap example that uses colorbar() is broken
for me. I think there's a problem with how Basemap sets the current
'image' so that a colorbar can be automatically generated for plots.
The code currently does:

    plt.gci._current = ret

I think the current image handling in matplotlib itself was reworked
(at least according to SVN logs, r7494), so that now instead there's a
setter function:

    plt.sci(ret)

I'd be happy fix these myself if you're too busy.

Ryan

···

--
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma

Ryan May wrote:

Jeff,

Right now, for me, any Basemap example that uses colorbar() is broken
for me. I think there's a problem with how Basemap sets the current
'image' so that a colorbar can be automatically generated for plots.
The code currently does:

    plt.gci._current = ret

I think the current image handling in matplotlib itself was reworked
(at least according to SVN logs, r7494), so that now instead there's a
setter function:

    plt.sci(ret)

I'd be happy fix these myself if you're too busy.

Ryan

Ryan: I'm off to Australia for a conference tomorrow, so if you could fix that I'd be grateful. I wonder if we shouldn't wrap the old plt.gci._current = ret in a try/except, and use the new way if an Attribute Error is raised. That way, it will still work with old versions of matplotlib.

Thanks for catching this.

-Jeff

···

--
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jeffrey.S.Whitaker@...259...
325 Broadway Office : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web : Jeffrey S. Whitaker: NOAA Physical Sciences Laboratory

Trying both sounds like a good idea, since I just noticed this change
is only in SVN trunk, and not in the 0.99.x series (which is probably
why no one noticed). However, no attribute error is raised when
setting the attribute, it's just never used. I'll see if I can come
up with something similar that will work.

Ryan

···

On Mon, Sep 28, 2009 at 4:54 PM, Jeff Whitaker <jswhit@...146...> wrote:

Ryan May wrote:

Jeff,

Right now, for me, any Basemap example that uses colorbar() is broken
for me. I think there's a problem with how Basemap sets the current
'image' so that a colorbar can be automatically generated for plots.
The code currently does:

plt.gci._current = ret

I think the current image handling in matplotlib itself was reworked
(at least according to SVN logs, r7494), so that now instead there's a
setter function:

plt.sci(ret)

I'd be happy fix these myself if you're too busy.

Ryan

Ryan: I'm off to Australia for a conference tomorrow, so if you could fix
that I'd be grateful. I wonder if we shouldn't wrap the old
plt.gci._current = ret in a try/except, and use the new way if an Attribute
Error is raised. That way, it will still work with old versions of
matplotlib.

--
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
Sent from Norman, Oklahoma, United States