John Hunter wrote:
> On Mon, Jan 26, 2009 at 2:14 PM, Nick Matzke <mat...@berkeley.edu> wrote:
>   
>> Hi Mauro,
>>
>> Update:
>>
>> 1. I went to the place that threw an error in the basemap code:
>>
>>  >>
>> "/Library/Frameworks/Python.framework/Versions/4.1.30101/lib/python2.5/site-packages/basemap-0.99.1.0001-py2.5-macosx-10.3-fat.egg/mpl_toolkits/basemap/__init__.py",
>>
>>  >> line 2501, in set_axes_limits
>>  >>     figManager.canvas.draw()
>>  >> AttributeError: 'NoneType' object has no attribute 'canvas'
>>  >>
>>  >>
>>
>>
>> The code is:
>>
>> ============
>>         # force draw if in interactive mode.
>>         if is_interactive():
>>             figManager = _pylab_helpers.Gcf.get_active()
>>             figManager.canvas.draw()
>> ============
>>
>>
>> So, I changed "interactive = true" to "interactive = false" in my
>> matplotlibrc file.
>>     
>
> Croizat is calling pylab here via basemap, which is a bug.  Croizat is
> a wx app, and should never import pylab or pyplot.  This is happening
> somewhere in basemap, most likely a call to basemap is not passing in
> an axes or figure instance in.  When basemap gets a default axes
> instance of None, it imports pyplot and creates its own.  I have no
> idea why this is happening on one platform and not another for
> Croizat, but this is where the bug is occurring most likely.
>
> A good way to track this down is to remove matplotlib/pyplot.py from
> site-packages and rerun.  The stack trace should show you which
> Croizat/basemap call is triggering the import, and you can fix it
> there.  The fix you are trying is dangerous, unsupported, and likely
> to fail in unpredicatable ways.
>
> JDH
>
>   
I think the problem could be solved by having the app explicity set interactive 
to false (using matplotlib.interactive(False)), instead of letting the users 
matplotlibrc determine it.  From a cursory look at the code, it looks like the 
app is not letting basemap create it's own axes instance with pyplot. It's just 
that if basemap finds that is_interactive is True, it will use pyplot for force 
the canvas to be drawn.

-Jeff

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


------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to