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: fix submerged margins algorithm being applied twice#30089

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
rcomer merged 1 commit intomatplotlib:mainfromjklymak:fix-nested-sfig
May 25, 2025

Conversation

jklymak
Copy link
Member

@jklymakjklymak commentedMay 20, 2025
edited
Loading

Closes#30076

If a figure had subfigures, the submerged margin algorithm (that tries to deal with margins that are not shared across all axes) would get applied toall axes in the figure, including any that had already been taken care of in a subfigure. This lead to the erroneous behaviour described in#30076.

New version does not apply the algorithm if the axes has already been dealt with in a subfigure.

importmatplotlib.pyplotaspltdeftest(layout,labelled=False):ll=labelledfig=plt.figure(figsize=(4,9),layout=layout)fig.suptitle(f'Labelled ={notlabelled}',fontsize='small')figures=fig.subfigures(4,1)forfinfigures.flatten():gs=f.add_gridspec(2,2)foriinrange(2):ax=f.add_subplot(gs[i,0])ax.plot()ifnotlabelled:ax.set_xlabel('BOOO',fontsize='large')labelled=Truef.add_subplot(gs[:,1]).plot()fig.savefig(f'fig_{notll}.png')test("constrained")#test("constrained", labelled=True)plt.show()

This PR

now yields:
fig_True

On main

fig_True

Test just makes sure that the appropriate subplots are the same height now. The test fails on main.

@jklymakjklymak added this to thev3.10.4 milestoneMay 20, 2025
@rcomerrcomer merged commit74ae218 intomatplotlib:mainMay 25, 2025
39 checks passed
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull requestMay 25, 2025
QuLogic added a commit that referenced this pull requestMay 27, 2025
…089-on-v3.10.xBackport PR#30089 on branch v3.10.x (FIX: fix submerged margins algorithm being applied twice)
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@timhoffmtimhoffmtimhoffm approved these changes

@rcomerrcomerrcomer approved these changes

Assignees
No one assigned
Labels
topic: geometry managerLayoutEngine, Constrained layout, Tight layout
Projects
None yet
Milestone
v3.10.4
Development

Successfully merging this pull request may close these issues.

[Bug]: Layout Managers are confused by complex arrangement of sub-figures and gridspec's
3 participants
@jklymak@timhoffm@rcomer

[8]ページ先頭

©2009-2025 Movatter.jp