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 0c7cdaa

Browse filesBrowse files
committed
Merge pull request #1163 from pwuertz/fix-tightlayout-bug
tight_layout: fix regression for figures with non SubplotBase Axes
2 parents cfc1d81 + 85438a0 commit 0c7cdaa
Copy full SHA for 0c7cdaa

File tree

Expand file treeCollapse file tree

1 file changed

+5
-6
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-6
lines changed

‎lib/matplotlib/figure.py

Copy file name to clipboardExpand all lines: lib/matplotlib/figure.py
+5-6Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1424,16 +1424,15 @@ def tight_layout(self, renderer=None, pad=1.08, h_pad=None, w_pad=None, rect=Non
14241424

14251425
from tight_layout import get_renderer, get_tight_layout_figure
14261426

1427-
no_go = [ax for ax in self.axes if not isinstance(ax, SubplotBase)]
1428-
if no_go:
1429-
warnings.Warn("Cannot use tight_layout;"
1430-
" all Axes must descend from SubplotBase")
1431-
return
1427+
subplot_axes = [ax for ax in self.axes if isinstance(ax, SubplotBase)]
1428+
if len(subplot_axes) < len(self.axes):
1429+
warnings.warn("tight_layout can only process Axes that descend "
1430+
"from SubplotBase; results might be incorrect.")
14321431

14331432
if renderer is None:
14341433
renderer = get_renderer(self)
14351434

1436-
kwargs = get_tight_layout_figure(self, self.axes, renderer,
1435+
kwargs = get_tight_layout_figure(self, subplot_axes, renderer,
14371436
pad=pad, h_pad=h_pad, w_pad=w_pad,
14381437
rect=rect)
14391438

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.