There was an error while loading. Please reload this page.
1 parent 5ac2113 commit 6a82f38Copy full SHA for 6a82f38
2 files changed
lib/matplotlib/figure.py
@@ -3512,7 +3512,7 @@ def tight_layout(self, *, pad=1.08, h_pad=None, w_pad=None, rect=None):
3512
and previous_engine is not None:
3513
_api.warn_external('The figure layout has changed to tight')
3514
finally:
3515
- self.set_layout_engine(None)
+ self.set_layout_engine('none')
3516
3517
3518
def figaspect(arg):
lib/matplotlib/tests/test_figure.py
@@ -621,6 +621,15 @@ def test_invalid_layouts():
621
fig.set_layout_engine("constrained")
622
623
624
+@check_figures_equal(extensions=["png"])
625
+def test_tightlayout_autolayout_deconflict(fig_test, fig_ref):
626
+ for fig, autolayout in zip([fig_ref, fig_test], [False, True]):
627
+ with mpl.rc_context({'figure.autolayout': autolayout}):
628
+ axes = fig.subplots(ncols=2)
629
+ fig.tight_layout(w_pad=10)
630
+ assert isinstance(fig.get_layout_engine(), PlaceHolderLayoutEngine)
631
+
632
633
@pytest.mark.parametrize('layout', ['constrained', 'compressed'])
634
def test_layout_change_warning(layout):
635
"""
0 commit comments