On 04/09/2010 06:44 AM, Mathew Yeates wrote:
> Can anyone verify this? If so, I'll submit it to the tracker.
>
> The following works without the --pylab switch but not with it. The error I
> get is some how related to a call to get the active figure  which returns
> None.
>
> C:\Python26\lib\site-packages\mpl_toolkits\basemap\__init__.pyc in
> set_axes_limi
> ts(self, ax)
>     2531         if is_interactive():
>     2532             figManager = _pylab_helpers.Gcf.get_active()
> ->  2533             figManager.canvas.draw()
>
> AttributeError:'NoneType'  object has no attribute'canvas'.
>
> In the following code. the error happens at
> m.drawcoastlines()
>
> Help?

Mathew,

Going back through my email stack I found your message. Testing on my 
machine, using mpl and basemap from svn, and using "ipython --pylab", I 
don't see any error.  The code that you show having raised the exception 
no longer exists--there is no longer any reference to _pylab_helpers--so 
I think the problem has been solved.

Eric

>
> ===============================================
> from mpl_toolkits.basemap import Basemap, shiftgrid
> import numpy as np
> import matplotlib.pyplot as plt
> from matplotlib.backends.backend_gtkagg import \
>          FigureCanvasGTKAgg as FigureCanvas
> import gtk
>
> # create new figure
> #fig=plt.figure()
> from matplotlib.figure import Figure
> fig = Figure(figsize=(5,5), dpi=100)
> canvas = FigureCanvas(fig)
> window = gtk.Window(gtk.WINDOW_TOPLEVEL)
> window.add(canvas)
> # setup cylindrical equidistant map projection (global domain).
> ax = fig.add_axes([0.1,0.1,0.7,0.7])
> m = Basemap(llcrnrlon=-180.,llcrnrlat=-90,urcrnrlon=180.,urcrnrlat=90.,\
>              resolution='c',area_thresh=10000.,projection='cyl',ax=ax)
> m.drawcoastlines()
> m.tissot(-117,34,10,10)
> #plt.show()
> canvas.show()
> window.show()
>

------------------------------------------------------------------------------

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to