8000 Merge pull request #13628 from QuLogic/backport-13603 · matplotlib/matplotlib@3d0675b · GitHub
[go: up one dir, main page]

Skip to content

Commit 3d0675b

Browse files
authored
Merge pull request #13628 from QuLogic/backport-13603
Backport PR #13603 on branch v3.1.x
2 parents 63343e7 + 745c086 commit 3d0675b

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

lib/matplotlib/tests/test_tightlayout.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,3 +338,5 @@ def test_collapsed():
338338
p2 = ax.get_position()
339339
assert p1.width == p2.width
340340
assert len(w) == 1
341+
# test that passing a rect doesn't crash...
342+
plt.tight_layout(rect=[0, 0, 0.8, 0.8])

lib/matplotlib/tight_layout.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,8 @@ def get_tight_layout_figure(fig, axes_list, subplotspec_list, renderer,
361361
ax_bbox_list=ax_bbox_list,
362362
pad=pad, h_pad=h_pad, w_pad=w_pad)
363363

364-
if rect is not None:
364+
# kwargs can be none if tight_layout fails...
365+
if rect is not None and kwargs is not None:
365366
# if rect is given, the whole subplots area (including
366367
# labels) will fit into the rect instead of the
367368
# figure. Note that the rect argument of

0 commit comments

Comments
 (0)
0