Basemap and clim, has this changed in 0.99

Hi, I've just upgraded to mpl 0.99 (from svn) and Basemap (also from svn).

It seems that plt.clim(vmin,vmax) no longer works with Basemap
objects. Here is an example, which before used to work:

In [92]: M.pcolormesh(x, y, a_var,cmap=cm)
Out[92]: <matplotlib.collections.QuadMesh object at 0x7f8f2faf3d90>

In [93]: plt.clim(-10,10)

···

---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)

/home/emason/pytools/fig_thesis_ssh_variance_prime_month.py in <module>()
----> 1
      2
      3
      4
      5

/usr/lib64/python2.6/site-packages/matplotlib/pyplot.pyc in clim(vmin, vmax)
   1379 im = gci()
   1380 if im is None:
-> 1381 raise RuntimeError('You must first define an image, eg
with imshow')
   1382
   1383 im.set_clim(vmin, vmax)

RuntimeError: You must first define an image, eg with imshow

In [94]:

Using plt.pcolormesh there's no problem. Has this change been done
intentionally? If so, what is now the recommended way to apply
climits to a Basemap plot?

Thanks, Evan

I think this is due to an issue I fixed yesterday. Matplotlib changed
how it handled tracking the current image (in trunk) and Basemap
hadn't been updated. A fresh pull of basemap (I checked in the
changes yesterday afternoon) should fix it. If not, we can dig
further.

Ryan

···

On Tue, Sep 29, 2009 at 12:52 PM, Evan Mason <evanmason@...287...> wrote:

Hi, I've just upgraded to mpl 0.99 (from svn) and Basemap (also from svn).

It seems that plt.clim(vmin,vmax) no longer works with Basemap
objects. Here is an example, which before used to work:

In [92]: M.pcolormesh(x, y, a_var,cmap=cm)
Out[92]: <matplotlib.collections.QuadMesh object at 0x7f8f2faf3d90>

In [93]: plt.clim(-10,10)
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)

/home/emason/pytools/fig_thesis_ssh_variance_prime_month.py in <module>()
----> 1
2
3
4
5

/usr/lib64/python2.6/site-packages/matplotlib/pyplot.pyc in clim(vmin, vmax)
1379 im = gci()
1380 if im is None:
-> 1381 raise RuntimeError('You must first define an image, eg
with imshow')
1382
1383 im.set_clim(vmin, vmax)

RuntimeError: You must first define an image, eg with imshow

In [94]:

Using plt.pcolormesh there's no problem. Has this change been done
intentionally? If so, what is now the recommended way to apply
climits to a Basemap plot?

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

Evan Mason wrote:

Hi, I've just upgraded to mpl 0.99 (from svn) and Basemap (also from svn).

Evan: I believe Ryan May just fixed this yesterday - so if you update basemap from svn again it should work.

-Jeff

···

It seems that plt.clim(vmin,vmax) no longer works with Basemap
objects. Here is an example, which before used to work:

In [92]: M.pcolormesh(x, y, a_var,cmap=cm)
Out[92]: <matplotlib.collections.QuadMesh object at 0x7f8f2faf3d90>

In [93]: plt.clim(-10,10)
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)

/home/emason/pytools/fig_thesis_ssh_variance_prime_month.py in <module>()
----> 1
      2
      3
      4
      5

/usr/lib64/python2.6/site-packages/matplotlib/pyplot.pyc in clim(vmin, vmax)
   1379 im = gci()
   1380 if im is None:
-> 1381 raise RuntimeError('You must first define an image, eg
with imshow')
   1382
   1383 im.set_clim(vmin, vmax)

RuntimeError: You must first define an image, eg with imshow

In [94]:

Using plt.pcolormesh there's no problem. Has this change been done
intentionally? If so, what is now the recommended way to apply
climits to a Basemap plot?

Thanks, Evan

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
  
--
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 : http://tinyurl.com/5telg

Yes, that works now. Thanks, Evan

···

On Tue, Sep 29, 2009 at 7:12 PM, Jeff Whitaker <jswhit@...146...> wrote:

Evan Mason wrote:

Hi, I've just upgraded to mpl 0.99 (from svn) and Basemap (also from svn).

Evan: I believe Ryan May just fixed this yesterday - so if you update
basemap from svn again it should work.

-Jeff

It seems that plt.clim(vmin,vmax) no longer works with Basemap
objects. Here is an example, which before used to work:

In [92]: M.pcolormesh(x, y, a_var,cmap=cm)
Out[92]: <matplotlib.collections.QuadMesh object at 0x7f8f2faf3d90>

In [93]: plt.clim(-10,10)

---------------------------------------------------------------------------
RuntimeError Traceback (most recent call
last)

/home/emason/pytools/fig_thesis_ssh_variance_prime_month.py in <module>()
----> 1
2
3
4
5

/usr/lib64/python2.6/site-packages/matplotlib/pyplot.pyc in clim(vmin,
vmax)
1379 im = gci()
1380 if im is None:
-> 1381 raise RuntimeError('You must first define an image, eg
with imshow')
1382
1383 im.set_clim(vmin, vmax)

RuntimeError: You must first define an image, eg with imshow

In [94]:

Using plt.pcolormesh there's no problem. Has this change been done
intentionally? If so, what is now the recommended way to apply
climits to a Basemap plot?

Thanks, Evan

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jeffrey.S.Whitaker@...2583...9...
325 Broadway Office : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg