I don't understand why the following fails.

fig = Figure(figsize=(5,5), dpi=100)
canvas = FigureCanvas(fig)
ax = fig.add_subplot(111)
m = Basemap(resolution='c',projection='cyl',lon_0=0,ax=ax)
m.drawcoastlines(color='gray',ax=ax)

fails with
mpl_toolkits\basemap\__init__.pyc in set_axes_limits ....
†† 2531 † † † † if is_interactive():
†† 2532 † † † † † † figManager = _pylab_helpers.Gcf.get_active()
-> 2533 † † † † † † figManager.canvas.draw()

AttributeError: 'NoneType' object has no attribute 'canvas'

Why isn't my figure being set as active??

Mathew








On Mon, Mar 29, 2010 at 11:12 AM, Yeates, Mathew C (388D) <mathew.c.yeates@jpl.nasa.gov> wrote:

Hi

Anyone have an example? I found some older examples which no longer work.

TIA

Mathew

For grins Ö. The following does not work. Iíve tried many different variations Ö

import matplotlib.pyplot as plt

import gtk

from mpl_toolkits.basemap import Basemap

import matplotlib

from matplotlib.figure import Figure

fig=plt.Figure()

ax=fig.add_subplot(111)

m = Basemap(llcrnrlon=1, \

††††††††††† llcrnrlat=40.6, \

††††††††††† urcrnrlon=8.8, \

††††††††††† urcrnrlat = 49.6, \

††††††††††† projection = 'tmerc', \

††††††††††† lon_0 = 4.9, \

††††††††††† lat_0 = 45.1,ax=ax)

from matplotlib.backends.backend_gtkagg import \

††††††††††††††††††††††† FigureCanvasGTKAgg as FigureCanvas

canvas = FigureCanvas(fig)

m.drawcoastlines(color='gray')

m.drawcountries(color='gray')

m.fillcontinents(color='beige')

builder = gtk.Builder()

builder.add_from_file("fluxtool.glade")

window1=builder.get_object("window1")

window1.connect("destroy", lambda x: gtk.main_quit())

vbox=builder.get_object("vbox1")

vbox.pack_start(canvas)

window1.show()

gtk.main()


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users