Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion lib/matplotlib/figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -3515,7 +3515,7 @@ def tight_layout(self, *, pad=1.08, h_pad=None, w_pad=None, rect=None):
and previous_engine is not None:
_api.warn_external('The figure layout has changed to tight')
finally:
self.set_layout_engine(None)
self.set_layout_engine('none')


def figaspect(arg):
Expand Down
9 changes: 9 additions & 0 deletions lib/matplotlib/tests/test_figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,15 @@ def test_invalid_layouts():
fig.set_layout_engine("constrained")


@check_figures_equal(extensions=["png"])
def test_tightlayout_autolayout_deconflict(fig_test, fig_ref):
for fig, autolayout in zip([fig_ref, fig_test], [False, True]):
with mpl.rc_context({'figure.autolayout': autolayout}):
axes = fig.subplots(ncols=2)
fig.tight_layout(w_pad=10)
assert isinstance(fig.get_layout_engine(), PlaceHolderLayoutEngine)


@pytest.mark.parametrize('layout', ['constrained', 'compressed'])
def test_layout_change_warning(layout):
"""
Expand Down