Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Fix cl subgridspec#22144

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
timhoffm merged 3 commits intomatplotlib:mainfromjklymak:fix-cl-subgridspec
Jan 9, 2022
Merged
Show file tree
Hide file tree
Changes fromall 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
8 changes: 5 additions & 3 deletionslib/matplotlib/_constrained_layout.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -204,14 +204,16 @@ def make_layoutgrids_gs(layoutgrids, gs):
layoutgrids = make_layoutgrids_gs(layoutgrids, parentgs)
subspeclb = layoutgrids[parentgs]
# gridspecfromsubplotspec need an outer container:
if f'{gs}top' not in layoutgrids:
layoutgrids[f'{gs}top'] = mlayoutgrid.LayoutGrid(
# get a unique representation:
rep = (gs, 'top')
if rep not in layoutgrids:
layoutgrids[rep] = mlayoutgrid.LayoutGrid(
parent=subspeclb,
name='top',
nrows=1, ncols=1,
parent_pos=(subplot_spec.rowspan, subplot_spec.colspan))
layoutgrids[gs] = mlayoutgrid.LayoutGrid(
parent=layoutgrids[f'{gs}top'],
parent=layoutgrids[rep],
name='gridspec',
nrows=gs._nrows, ncols=gs._ncols,
width_ratios=gs.get_width_ratios(),
Expand Down
20 changes: 20 additions & 0 deletionslib/matplotlib/tests/test_constrainedlayout.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -115,6 +115,26 @@ def test_constrained_layout6():
ticks=ticker.MaxNLocator(nbins=5))


def test_identical_subgridspec():

fig = plt.figure(constrained_layout=True)

GS = fig.add_gridspec(2, 1)

GSA = GS[0].subgridspec(1, 3)
GSB = GS[1].subgridspec(1, 3)

axa = []
axb = []
for i in range(3):
axa += [fig.add_subplot(GSA[i])]
axb += [fig.add_subplot(GSB[i])]

fig.draw_without_rendering()
# chech first row above second
assert axa[0].get_position().y0 > axb[0].get_position().y1


def test_constrained_layout7():
"""Test for proper warning if fig not set in GridSpec"""
with pytest.warns(
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp