Animation example error on Mac after installation

Greetings,

I just installed matplotlib on my Mac OS 10.6 Machine (64bit) with default Python 2.7.1 (easy_install). While the initial 2D graph examples work great, when testing any of the animations, such as:
http://matplotlib.sourceforge.net/examples/animation/simple_anim.html

I always get the same error:

File “/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/animation.py”, line 248, in _blit_clear
a.figure.canvas.restore_region(bg_cache[a])
AttributeError: ‘FigureCanvasMac’ object has no attribute ‘restore_region’

Since “restore_region” is only in backend_agg.py and not in backend_macosx.py, After reading more on this, I thought this might be corrected by re-installing from source and setting the setup.cfg to macosx = True and backend = MacOSX prior to building, but this did not correct the issue. Also, changing backend: Agg to backend: MacOSX in:
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/mpl-data/matplotlibrc

didn’t work either. Does anyone have experience with this or further insight?

Thanks,
Nathan

Yes, I encountered this before. The problem is with blitting and the macosx backend. Have you tried using a different backend or setting blit=False in some of the animation commands?

Ben Root

···

On Sun, Jan 15, 2012 at 1:14 AM, Nathan Salomonis <nsalomonis@…287…> wrote:

Greetings,

I just installed matplotlib on my Mac OS 10.6 Machine (64bit) with default Python 2.7.1 (easy_install). While the initial 2D graph examples work great, when testing any of the animations, such as:
http://matplotlib.sourceforge.net/examples/animation/simple_anim.html

I always get the same error:

File “/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/animation.py”, line 248, in _blit_clear
a.figure.canvas.restore_region(bg_cache[a])

AttributeError: ‘FigureCanvasMac’ object has no attribute ‘restore_region’

Since “restore_region” is only in backend_agg.py and not in backend_macosx.py, After reading more on this, I thought this might be corrected by re-installing from source and setting the setup.cfg to macosx = True and backend = MacOSX prior to building, but this did not correct the issue. Also, changing backend: Agg to backend: MacOSX in:

/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/mpl-data/matplotlibrc

didn’t work either. Does anyone have experience with this or further insight?

Thanks,

Nathan

The animation code is currently not fully implemented in the MacOSX backend because the way the general framework of animations is set up in Matplotlib (at least last time I checked) is not compatible with drawing on Mac OS X. In particular, the problem is that on Mac OS X all drawing should be done from inside the event loop; the animations code also tries to draw outside of the event loop. Somebody would have to go through the animations code in matplotlib to sort this out. See e.g. this previous thread on the devel mailing list:
http://sourceforge.net/mailarchive/forum.php?thread_name=989472.4458.qm%40web62407.mail.re1.yahoo.com&forum_name=matplotlib-devel
Best,
-Michiel.

···

— On Sun, 1/15/12, Nathan Salomonis <nsalomonis@…287…> wrote:

From: Nathan Salomonis <nsalomonis@…287…>
Subject: [Matplotlib-users] Animation example error on Mac after installation
To: matplotlib-users@lists.sourceforge.net
Date: Sunday, January 15, 2012, 2:14 AM

Greetings,

I just installed matplotlib on my Mac OS 10.6 Machine (64bit) with default Python 2.7.1 (easy_install). While the initial 2D graph examples work great, when testing any of the animations, such as:
http://matplotlib.sourceforge.net/examples/animation/simple_anim.html

I always get the same error:

File “/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/animation.py”, line 248, in _blit_clear
a.figure.canvas.restore_region(bg_cache[a])

AttributeError: ‘FigureCanvasMac’ object has no attribute ‘restore_region’

Since “restore_region” is only in backend_agg.py and not in backend_macosx.py, After reading more on this, I thought this might be corrected by re-installing from source and setting the setup.cfg to macosx = True and backend = MacOSX prior to building, but this did not correct the issue. Also, changing backend: Agg to backend: MacOSX in:

/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/mpl-data/matplotlibrc

didn’t work either. Does anyone have experience with this or further insight?

Thanks,

Nathan

-----Inline Attachment Follows-----


Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d

-----Inline Attachment Follows-----


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