Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Backport PR #22732: FIX: maybe improve renderer dance #22783

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/matplotlib/figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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)

Expand Down Expand Up @@ -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,
Expand Down