Skip to content

Fix animation blitting for plots with shared axes #14880

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

Merged
merged 1 commit into from
Jul 24, 2019
Merged

Fix animation blitting for plots with shared axes #14880

merged 1 commit into from
Jul 24, 2019

Conversation

barabanus
Copy link

@barabanus barabanus commented Jul 24, 2019

Hi there!

Let me introduce a small but very useful fix for animation blitting for plots which share axes.

Currently, we enumerate artists to both cache background and draw artists in a single pass. But imagine we've got twin plot that share the same axis. As the first sibling draws foreground before the second managed to cache the background we've got incorrect background for the second sibling!

Fortunately, it's easy to fix if we cache background and draw foreground with two distinct passes. Please apply this change because it's very annoying to not have animated twin plots.

Copy link
Member

@ImportanceOfBeingErnest ImportanceOfBeingErnest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks correct. Running through the artists twice may actually make this a bit slower than before, but it shouldn't be the bottleneck.

@timhoffm timhoffm merged commit c75b807 into matplotlib:master Jul 24, 2019
@timhoffm
Copy link
Member

Thanks, and congratulations on your first contribution to Matplotlib! Maybe see you back some time.

@barabanus
Copy link
Author

@timhoffm Thank you too. This bug annoyed me for a month until I decided to examine the code =) Well, it appeared to be not that hard after all.

@barabanus barabanus deleted the fix-animation-for-twin-plots branch July 25, 2019 07:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants