Embedding Basemap in a wx app

I'm CC-ing the list, because Jeff Whitaker is the basemap developer,
and he will probably want to add it to the basemap examples. Thanks
for the contribution.


On Wed, Nov 19, 2008 at 4:31 PM, Mauro Cavalcanti <maurobio@...287...> wrote:

Dear John,

It worked fine!

Thank you very much for your help. I would like to donate the working
example source code (attached) to the Matplotlib examples section,
just in case it may be helpful to someone else.

I intend to provide a more sophisticated exemple soon.

With warmest regards,

2008/11/19 John Hunter <jdh2358@...287...>:

On Wed, Nov 19, 2008 at 2:31 PM, Mauro Cavalcanti <maurobio@...287...> wrote:

Greetings. Trying to develop a desktop application for interactive
mapping using wxPython and Matplotlib, I have been doing some
experiments with embedding maps generated by the Basemap module into a
wxPython frame.

You are almost there. You need to create your own axes instance

   self.ax = self.figure.add_subplot(111)

and then pass this to your basemap

   map = Basemap(ax=self.ax)

after you have issued all your basemap commands, manually force a draw


and *do not* import pyplot or call pyplot.show()


Dr. Mauro J. Cavalcanti
Ecoinformatics Studio
P.O. Box 46521, CEP 20551-970
Rio de Janeiro, RJ, BRASIL
E-mail: maurobio@...287...
Web: http://studio.infobio.net
Linux Registered User #473524 * Ubuntu User #22717
"Life is complex. It consists of real and imaginary parts."