From 851177f47e7e81e2b0e5016354a687ad65353cd6 Mon Sep 17 00:00:00 2001 From: Ruth Comer <10599679+rcomer@users.noreply.github.com> Date: Thu, 11 Jul 2024 20:30:42 +0100 Subject: [PATCH] Subfigures become stale when their artists are stale --- lib/matplotlib/figure.py | 4 ++-- lib/matplotlib/tests/test_figure.py | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/matplotlib/figure.py b/lib/matplotlib/figure.py index 51bac3455a28..41d4b6078223 100644 --- a/lib/matplotlib/figure.py +++ b/lib/matplotlib/figure.py @@ -64,8 +64,8 @@ def _stale_figure_callback(self, val): - if self.figure: - self.figure.stale = val + if (fig := self.get_figure(root=False)) is not None: + fig.stale = val class _AxesStack: diff --git a/lib/matplotlib/tests/test_figure.py b/lib/matplotlib/tests/test_figure.py index 4e73d4091200..99045e773d02 100644 --- a/lib/matplotlib/tests/test_figure.py +++ b/lib/matplotlib/tests/test_figure.py @@ -1774,10 +1774,13 @@ def test_subfigure_stale_propagation(): sfig2 = sfig1.subfigures() assert fig.stale + assert sfig1.stale fig.draw_without_rendering() assert not fig.stale + assert not sfig1.stale assert not sfig2.stale sfig2.stale = True + assert sfig1.stale assert fig.stale pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy