From b192f8a4f98cf67462606a1d172f5331c1ba1b62 Mon Sep 17 00:00:00 2001 From: radliff Date: Tue, 1 Oct 2024 12:34:48 -0400 Subject: [PATCH] fixed animated issue --- lib/matplotlib/axes/_base.py | 2 +- lib/matplotlib/tests/test_axes.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/axes/_base.py b/lib/matplotlib/axes/_base.py index 20cea0a917e1..cfb9e01852fc 100644 --- a/lib/matplotlib/axes/_base.py +++ b/lib/matplotlib/axes/_base.py @@ -3123,7 +3123,7 @@ def draw(self, renderer): if not self.get_figure(root=True).canvas.is_saving(): artists = [ a for a in artists - if not a.get_animated() or isinstance(a, mimage.AxesImage)] + if not a.get_animated()] artists = sorted(artists, key=attrgetter('zorder')) # rasterize artists with negative zorder diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index e3877dbad7af..93a41ea17dd8 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -9003,6 +9003,11 @@ def test_zorder_and_explicit_rasterization(): with io.BytesIO() as b: fig.savefig(b, format='pdf') +@check_figures_equal(extensions=["png"]) +def test_anim_without_image(fig_test, fig_ref): + ax_ref = fig_ref.subplots() + imdata = np.random.random((20,20)) + ax_ref.plot(imdata, animated=true) @image_comparison(["preset_clip_paths.png"], remove_text=True, style="mpl20", tol=0.027 if platform.machine() == "arm64" else 0)