diff --git a/lib/matplotlib/figure.py b/lib/matplotlib/figure.py index adde53519c1c..b4a3c326b388 100644 --- a/lib/matplotlib/figure.py +++ b/lib/matplotlib/figure.py @@ -3144,7 +3144,7 @@ def execute_constrained_layout(self, renderer=None): ------- layoutgrid : private debugging object """ - + from matplotlib.tight_layout import get_renderer from matplotlib._constrained_layout import do_constrained_layout _log.debug('Executing constrainedlayout') @@ -3155,7 +3155,7 @@ def execute_constrained_layout(self, renderer=None): w_pad = w_pad / width h_pad = h_pad / height if renderer is None: - renderer = _get_renderer(fig) + renderer = get_renderer(fig) return do_constrained_layout(fig, renderer, h_pad, w_pad, hspace, wspace) @@ -3186,13 +3186,13 @@ def tight_layout(self, *, pad=1.08, h_pad=None, w_pad=None, rect=None): """ from contextlib import nullcontext from .tight_layout import ( - get_subplotspec_list, get_tight_layout_figure) + get_subplotspec_list, get_tight_layout_figure, get_renderer) subplotspec_list = get_subplotspec_list(self.axes) if None in subplotspec_list: _api.warn_external("This figure includes Axes that are not " "compatible with tight_layout, so results " "might be incorrect.") - renderer = _get_renderer(self) + renderer = get_renderer(self) with getattr(renderer, "_draw_disabled", nullcontext)(): kwargs = get_tight_layout_figure( self, self.axes, subplotspec_list, renderer,