From c8c3767b7b03e69231977f53ebff30750360e472 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Mon, 4 Apr 2022 18:22:21 -0400 Subject: [PATCH 1/2] 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 9e0eb54fd98bb804f51a74101db88164870a2458) 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. --- lib/matplotlib/figure.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/matplotlib/figure.py b/lib/matplotlib/figure.py index adde53519c1c..86c49d40e0e0 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, From 2730a26af160f23ae6412f89db61a1b5635dc36a Mon Sep 17 00:00:00 2001 From: Jody Klymak Date: Tue, 5 Apr 2022 09:35:44 +0200 Subject: [PATCH 2/2] fix import --- lib/matplotlib/figure.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/figure.py b/lib/matplotlib/figure.py index 86c49d40e0e0..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.tight_layout import get_renderer from matplotlib._constrained_layout import do_constrained_layout _log.debug('Executing constrainedlayout') pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy