diff --git a/lib/matplotlib/_tight_bbox.py b/lib/matplotlib/_tight_bbox.py index b2147b960735..e0fba389d120 100644 --- a/lib/matplotlib/_tight_bbox.py +++ b/lib/matplotlib/_tight_bbox.py @@ -17,8 +17,6 @@ def adjust_bbox(fig, bbox_inches, fixed_dpi=None): """ origBbox = fig.bbox origBboxInches = fig.bbox_inches - orig_layout = fig.get_layout_engine() - fig.set_layout_engine(None) _boxout = fig.transFigure._boxout old_aspect = [] @@ -46,7 +44,6 @@ def restore_bbox(): fig.bbox = origBbox fig.bbox_inches = origBboxInches - fig.set_layout_engine(orig_layout) fig.transFigure._boxout = _boxout fig.transFigure.invalidate() fig.patch.set_bounds(0, 0, 1, 1) diff --git a/lib/matplotlib/tests/test_figure.py b/lib/matplotlib/tests/test_figure.py index 065e0f728536..f3ece07660e3 100644 --- a/lib/matplotlib/tests/test_figure.py +++ b/lib/matplotlib/tests/test_figure.py @@ -532,6 +532,13 @@ def test_savefig_pixel_ratio(backend): assert ratio1 == ratio2 +def test_savefig_preserve_layout_engine(tmp_path): + fig = plt.figure(layout='compressed') + fig.savefig(tmp_path / 'foo.png', bbox_inches='tight') + + assert fig.get_layout_engine()._compress + + def test_figure_repr(): fig = plt.figure(figsize=(10, 20), dpi=10) assert repr(fig) == "
" 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