From 6e3e9677d7096fcfea642973b48cb74c32906211 Mon Sep 17 00:00:00 2001 From: brut Date: Wed, 24 Jul 2019 16:08:53 +0300 Subject: [PATCH] Fix animation blitting for plots with shared axes --- lib/matplotlib/animation.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/matplotlib/animation.py b/lib/matplotlib/animation.py index 866efd764584..e86a109ce93a 100644 --- a/lib/matplotlib/animation.py +++ b/lib/matplotlib/animation.py @@ -1216,12 +1216,18 @@ def _blit_draw(self, artists, bg_cache): # Handles blitted drawing, which renders only the artists given instead # of the entire figure. updated_ax = [] + + # Enumerate artists to cache axes' backgrounds. We do not draw + # artists yet to not cache foreground from plots with shared axes for a in artists: # If we haven't cached the background for this axes object, do # so now. This might not always be reliable, but it's an attempt # to automate the process. if a.axes not in bg_cache: bg_cache[a.axes] = a.figure.canvas.copy_from_bbox(a.axes.bbox) + + # Make a separate pass to draw foreground + for a in artists: a.axes.draw_artist(a) updated_ax.append(a.axes)