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?
···
===============================================
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()