Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error running double pendulum animation example #4901

Closed
jakirkham opened this issue Aug 11, 2015 · 14 comments
Closed

Error running double pendulum animation example #4901

jakirkham opened this issue Aug 11, 2015 · 14 comments
Milestone

Comments

@jakirkham
Copy link

Using this example ( http://matplotlib.org/examples/animation/double_pendulum_animated.html ) in an iPython Notebook on Mac OS 10.9 and version 1.4.3 of matplotlib. I encounter infinite recursion. See notebook here ( http://nbviewer.ipython.org/github/jakirkham/double_pendulum_animated/blob/master/double_pendulum_animated.ipynb ).

@tacaswell
Copy link
Member

what version of mpl and what backend?

@jakirkham
Copy link
Author

Matplotlib version was 1.4.3. Backend is whatever the default is. This is using the matplotlib from conda.

@dopplershift
Copy link
Contributor

Any chance you were running master?

@jenshnielsen
Copy link
Member

Looking at the Traceback it must be the OSX backend

@jenshnielsen
Copy link
Member

AttributeError: 'FigureCanvasMac' object has no attribute 'restore_region'

@dopplershift
Copy link
Contributor

I can reproduce this just from the command line using OSX backend; works with Qt4Agg backend.

But is this just a manifestation of the fact that the OSX backend doesn't support blitting (at least like the other backends do)?

@dopplershift
Copy link
Contributor

Works if I change call to animation to set blit=False.

@jakirkham
Copy link
Author

@dopplershift, nope, wasn't using master.

@mdehoon
Copy link
Contributor

mdehoon commented Aug 12, 2015

Same issue as #531

@mdehoon
Copy link
Contributor

mdehoon commented Aug 12, 2015

Using the tkagg backend, with the current master, the script also encounters an error when blitting:

...
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-macosx-10.9-x86_64.egg/matplotlib/animation.py", line 862, in _blit_clear
    a.figure.canvas.restore_region(bg_cache[a])
KeyError: <matplotlib.axes._subplots.AxesSubplot object at 0x10cc9bc10>

The script works correctly if blit=False.

@tacaswell
Copy link
Member

I think this is reported in the that issue with a list of 1.5 bugs (but
with less detail there so i am not sure).

On Tue, Aug 11, 2015, 10:41 PM mdehoon notifications@github.com wrote:

Using the tkagg backend, with the current master, the script also
encounters into an error when blitting:

...
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-macosx-10.9-x86_64.egg/matplotlib/animation.py", line 862, in _blit_clear
a.figure.canvas.restore_region(bg_cache[a])
KeyError: <matplotlib.axes._subplots.AxesSubplot object at 0x10cc9bc10>

The script works correctly if blit=False.


Reply to this email directly or view it on GitHub
#4901 (comment)
.

@tacaswell
Copy link
Member

@mdehoon I can reproduce your bug only if interactive mode in on.

Interestingly if you resize the window to force a re-draw the animation starts up so I suspect that this is due to something forcing a draw too soon (which is probably the PR I put in to fix inline).

if you start the script with python -i animation.py it runs very slowly on current master due to the stale flags being agressively processed (so lots of extra draws), but it works correctly with ipython -i animation.py because the draw_idle calls are triggered by an IPython event hook which does not get hit by this code path. One of the commits in #4738 makes this a bit better, but if you switch to that branch you can call plt.ion() and plt.ioff() and watch the frame rate change.

@tacaswell
Copy link
Member

@mdehoon I have pushed commits to #4738 that seems to fix all of these issues.

@mdboom
Copy link
Member

mdboom commented Nov 3, 2015

Closed by #4738

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants