Skip to content

Commit 6b56525

Browse files
committed
ADD
1 parent f09ad19 commit 6b56525

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

lib/matplotlib/_constrained_layout.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,24 @@ def _make_margin_suptitles(fig, renderer, *, w_pad=0, h_pad=0):
224224

225225

226226
def _match_submerged_margins(fig):
227+
"""
228+
Make the margins that are submerged inside an axes the same
229+
size.
230+
231+
This allows axes that span two columns (or rows) that are offset
232+
from one another to have the same size.
233+
234+
i.e. if in row 0, the axes is at columns 0, 1 and for row 1,
235+
the axes is at columns 1 and 2, then the right margin at row 0
236+
needs to be the same size as the right margin at row 1 and
237+
the left margin for rows 1 and 2 should be the same.
238+
239+
See test_constrained_layout::test_constrained_layout12 for an example.
240+
"""
241+
227242
for panel in fig.panels:
228243
_match_submerged_margins(panel)
244+
229245
axs = [a for a in fig._localaxes if hasattr(a, 'get_subplotspec')]
230246
for ax1 in axs:
231247
ss1 = ax1.get_subplotspec()

0 commit comments

Comments
 (0)