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

Skip to content

Commit 9e0eb54

Browse files
authored
Merge pull request #22732 from jklymak/fix-renderer-dance
FIX: improve cached renderer dance
2 parents 1602635 + bda8790 commit 9e0eb54

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

lib/matplotlib/_constrained_layout.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import numpy as np
1919

2020
from matplotlib import _api, artist as martist
21-
from matplotlib.backend_bases import _get_renderer
21+
from matplotlib._tight_layout import get_renderer
2222
import matplotlib.transforms as mtransforms
2323
import matplotlib._layoutgrid as mlayoutgrid
2424

@@ -92,7 +92,7 @@ def do_constrained_layout(fig, h_pad, w_pad,
9292
layoutgrid : private debugging structure
9393
"""
9494

95-
renderer = _get_renderer(fig)
95+
renderer = get_renderer(fig)
9696
# make layoutgrid tree...
9797
layoutgrids = make_layoutgrids(fig, None)
9898
if not layoutgrids['hasgrids']:

lib/matplotlib/layout_engine.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
from matplotlib._constrained_layout import do_constrained_layout
2323
from matplotlib._tight_layout import (get_subplotspec_list,
2424
get_tight_layout_figure)
25-
from matplotlib.backend_bases import _get_renderer
25+
# from matplotlib.backend_bases import _get_renderer
26+
from matplotlib._tight_layout import get_renderer
2627

2728

2829
class LayoutEngine:
@@ -153,7 +154,7 @@ def execute(self, fig):
153154
_api.warn_external("This figure includes Axes that are not "
154155
"compatible with tight_layout, so results "
155156
"might be incorrect.")
156-
renderer = _get_renderer(fig)
157+
renderer = get_renderer(fig)
157158
with getattr(renderer, "_draw_disabled", nullcontext)():
158159
kwargs = get_tight_layout_figure(
159160
fig, fig.axes, subplotspec_list, renderer,

0 commit comments

Comments
 (0)