Skip to content

Commit c8c3767

Browse files
committed
Backport PR #22732: FIX: maybe improve renderer dance
Merge pull request #22732 from jklymak/fix-renderer-dance FIX: improve cached renderer dance (cherry picked from commit 9e0eb54) The changes had to be moved to figure.py due to a major refactoring that will be released in 3.6 that is already on main.
1 parent 65159a9 commit c8c3767

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/matplotlib/figure.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -3144,7 +3144,7 @@ def execute_constrained_layout(self, renderer=None):
31443144
-------
31453145
layoutgrid : private debugging object
31463146
"""
3147-
3147+
from matplotlib._tight_layout import get_renderer
31483148
from matplotlib._constrained_layout import do_constrained_layout
31493149

31503150
_log.debug('Executing constrainedlayout')
@@ -3155,7 +3155,7 @@ def execute_constrained_layout(self, renderer=None):
31553155
w_pad = w_pad / width
31563156
h_pad = h_pad / height
31573157
if renderer is None:
3158-
renderer = _get_renderer(fig)
3158+
renderer = get_renderer(fig)
31593159
return do_constrained_layout(fig, renderer, h_pad, w_pad,
31603160
hspace, wspace)
31613161

@@ -3186,13 +3186,13 @@ def tight_layout(self, *, pad=1.08, h_pad=None, w_pad=None, rect=None):
31863186
"""
31873187
from contextlib import nullcontext
31883188
from .tight_layout import (
3189-
get_subplotspec_list, get_tight_layout_figure)
3189+
get_subplotspec_list, get_tight_layout_figure, get_renderer)
31903190
subplotspec_list = get_subplotspec_list(self.axes)
31913191
if None in subplotspec_list:
31923192
_api.warn_external("This figure includes Axes that are not "
31933193
"compatible with tight_layout, so results "
31943194
"might be incorrect.")
3195-
renderer = _get_renderer(self)
3195+
renderer = get_renderer(self)
31963196
with getattr(renderer, "_draw_disabled", nullcontext)():
31973197
kwargs = get_tight_layout_figure(
31983198
self, self.axes, subplotspec_list, renderer,

0 commit comments

Comments
 (0)