Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 745c086

Browse filesBrowse files
committed
Merge pull request #13603 from jklymak/fix-bail-tight-layout
FIX: continue to bail tight layout if rect supplied
1 parent 63343e7 commit 745c086
Copy full SHA for 745c086

File tree

Expand file treeCollapse file tree

2 files changed

+4
-1
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+4
-1
lines changed

‎lib/matplotlib/tests/test_tightlayout.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_tightlayout.py
+2Lines 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

Copy file name to clipboardExpand all lines: lib/matplotlib/tight_layout.py
+2-1Lines 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)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.