@@ -1976,6 +1976,10 @@ class SubFigure(FigureBase):
19761976
19771977 See :doc:`/gallery/subplots_axes_and_figures/subfigures`
19781978 """
1979+ callbacks = _api .deprecated (
1980+ "3.6" ,alternative = ("the 'resize_event' signal in "
1981+ "Figure.canvas.callbacks" )
1982+ )(property (lambda self :self ._fig_callbacks ))
19791983
19801984def __init__ (self ,parent ,subplotspec ,* ,
19811985facecolor = None ,
@@ -2024,7 +2028,7 @@ def __init__(self, parent, subplotspec, *,
20242028self ._subplotspec = subplotspec
20252029self ._parent = parent
20262030self .figure = parent .figure
2027- self .callbacks = parent .callbacks
2031+ self ._fig_callbacks = parent ._fig_callbacks
20282032
20292033# subfigures use the parent axstack
20302034self ._axstack = parent ._axstack
@@ -2156,11 +2160,6 @@ class Figure(FigureBase):
21562160"""
21572161 The top level container for all the plot elements.
21582162
2159- The Figure instance supports callbacks through a *callbacks* attribute
2160- which is a `.CallbackRegistry` instance. The events you can connect to
2161- are 'dpi_changed', and the callback will be called with ``func(fig)`` where
2162- fig is the `Figure` instance.
2163-
21642163 Attributes
21652164 ----------
21662165 patch
@@ -2171,6 +2170,12 @@ class Figure(FigureBase):
21712170 depending on the renderer option_image_nocomposite function. If
21722171 *suppressComposite* is a boolean, this will override the renderer.
21732172 """
2173+ # Remove the self._fig_callbacks properties on figure and subfigure
2174+ # after the deprecation expires.
2175+ callbacks = _api .deprecated (
2176+ "3.6" ,alternative = ("the 'resize_event' signal in "
2177+ "Figure.canvas.callbacks" )
2178+ )(property (lambda self :self ._fig_callbacks ))
21742179
21752180def __str__ (self ):
21762181return "Figure(%gx%g)" % tuple (self .bbox .size )
@@ -2303,7 +2308,7 @@ def __init__(self,
23032308# everything is None, so use default:
23042309self .set_layout_engine (layout = layout )
23052310
2306- self .callbacks = cbook .CallbackRegistry (signals = ["dpi_changed" ])
2311+ self ._fig_callbacks = cbook .CallbackRegistry (signals = ["dpi_changed" ])
23072312# Callbacks traditionally associated with the canvas (and exposed with
23082313# a proxy property), but that actually need to be on the figure for
23092314# pickling.
@@ -2502,7 +2507,7 @@ def _set_dpi(self, dpi, forward=True):
25022507self .dpi_scale_trans .clear ().scale (dpi )
25032508w ,h = self .get_size_inches ()
25042509self .set_size_inches (w ,h ,forward = forward )
2505- self .callbacks .process ('dpi_changed' ,self )
2510+ self ._fig_callbacks .process ('dpi_changed' ,self )
25062511
25072512dpi = property (_get_dpi ,_set_dpi ,doc = "The resolution in dots per inch." )
25082513