-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Animation: interactive zoom/pan with blitting does not work #13488
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
Conversation
In an animation using blitting that contains some static graphics elements, the static parts of the figure are not updated after an interactive zoom/pan event. However, they are correctly updated after an resize event.
This seems OK. Is the test just to run what you did in #13478? It would be good if a blitting expert chimed in. Assigning one ;-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change for blotting seems appropriate to me. Minor suggestion on how to handle removing the axis, but no need to hold up for that.
lib/matplotlib/animation.py
Outdated
@@ -1222,6 +1222,14 @@ def _setup_blit(self): | |||
# axes | |||
self._blit_cache = dict() | |||
self._drawn_artists = [] | |||
def remove_from_cache(ax): | |||
try: | |||
del self._blit_cache[ax] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could replace the whole block with:
self._blit_cache.pop(ax, None)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dopplershift,
I really like your proposal. The second argument of dict.pop did not come to my mind. We could make my proposal much more concise:
self._drawn_artists = []
for ax in self._fig.axes:
ax.callbacks.connect('xlim_changed',
lambda ax: self._blit_cache.pop(ax, None))
ax.callbacks.connect('ylim_changed',
lambda ax: self._blit_cache.pop(ax, None))
self._resize_id = self._fig.canvas.mpl_connect('resize_event',
self._handle_resize)
This was my first contribution to matplotlib. Shall I file another pull request for this modification?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@onatt, no just modify this PR, add a new commit on your machine, and then push... https://matplotlib.org/devel/index.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Not worried about the coverage for the code itself. A little confused why coverage of tests themselves dropped, but there's no reason this change should be involved.
As this is a bugfix, should it go in 3.1? |
I think that would be appropriate. I think 3.1 branched after it was submitted. |
…itting does not work
Something went wrong ... Please have a look at my logs. |
…488-on-v3.1.x Backport PR #13488 on branch v3.1.x (Animation: interactive zoom/pan with blitting does not work)
PR Summary
In an animation using blitting that contains some static graphics elements, the static parts of the figure are not updated after an interactive zoom/pan event. However, they are correctly updated after an resize event (see issue #13478).
PR Checklist