Skip to content

Backport PR #13603 on branch v3.1.x #13628

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 8, 2019
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: 2 additions & 0 deletions lib/matplotlib/tests/test_tightlayout.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,3 +338,5 @@ def test_collapsed():
p2 = ax.get_position()
assert p1.width == p2.width
assert len(w) == 1
# test that passing a rect doesn't crash...
plt.tight_layout(rect=[0, 0, 0.8, 0.8])
3 changes: 2 additions & 1 deletion lib/matplotlib/tight_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,8 @@ def get_tight_layout_figure(fig, axes_list, subplotspec_list, renderer,
ax_bbox_list=ax_bbox_list,
pad=pad, h_pad=h_pad, w_pad=w_pad)

if rect is not None:
# kwargs can be none if tight_layout fails...
if rect is not None and kwargs is not None:
# if rect is given, the whole subplots area (including
# labels) will fit into the rect instead of the
# figure. Note that the rect argument of
Expand Down