From 5b0d225ba821e2f63914190b113696a6f5ec4bca Mon Sep 17 00:00:00 2001 From: Jody Klymak Date: Fri, 8 Apr 2022 19:19:47 +0200 Subject: [PATCH] FIX: callback for subfigure uses parent --- lib/matplotlib/figure.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/figure.py b/lib/matplotlib/figure.py index a8f953760a6f..2e5830ec2463 100644 --- a/lib/matplotlib/figure.py +++ b/lib/matplotlib/figure.py @@ -924,7 +924,6 @@ def clear(self, keep_observers=False): a gui widget is tracking the Axes in the figure. """ self.suppressComposite = None - self.callbacks = cbook.CallbackRegistry() # first clear the axes in any subfigures for subfig in self.subfigs: @@ -2025,6 +2024,8 @@ def __init__(self, parent, subplotspec, *, self._subplotspec = subplotspec self._parent = parent self.figure = parent.figure + self.callbacks = parent.callbacks + # subfigures use the parent axstack self._axstack = parent._axstack self.subplotpars = parent.subplotpars