Skip to content

Use format() for shared subplot slice titles - #652

Merged
cvanelteren merged 8 commits into
mainfrom
feature/shared-subplot-title
Apr 7, 2026
Merged

Use format() for shared subplot slice titles#652
cvanelteren merged 8 commits into
mainfrom
feature/shared-subplot-title

Conversation

@cvanelteren

Copy link
Copy Markdown
Collaborator

We should make more use of the slicing feature to format a subset and assume the user aims to share the titles. This is a move in making the format function more intuitive.

Closes #650#651

This comment was marked as outdated.

This comment was marked as off-topic.

@cvanelteren

Copy link
Copy Markdown
CollaboratorAuthor

Need to fix a small bbox alignment but other than that it works.

@codecov

codecovBot commented Mar 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.20000% with 32 lines in your changes missing coverage. Please review.

Files with missing linesPatch %Lines
ultraplot/figure.py70.29%17 Missing and 13 partials ⚠️
ultraplot/gridspec.py93.93%1 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@gepcel

Copy link
Copy Markdown
Collaborator

The fix messed up the spaces between rows of axes, when using shared titles with subset of axes.

@cvanelteren

Copy link
Copy Markdown
CollaboratorAuthor

@gepcel do you have an example?

@cvanelteren

Copy link
Copy Markdown
CollaboratorAuthor
importultraplotasuplt# Test whether ignored for bar plotsfig, ax=uplt.subplots(ncols=2, nrows=2)
ax[0, :].format(title="True")
ax[1, :].format(title="True")
uplt.show(block=1

Looks good I think

@cvanelteren

Copy link
Copy Markdown
CollaboratorAuthor
image

@gepcel

Copy link
Copy Markdown
Collaborator
fig,ax=pplt.subplots(ncols=4, nrows=2, refwidth=1)
ax[:,:3].format(title="A test title")
image

@cvanelteren

Copy link
Copy Markdown
CollaboratorAuthor

Thanks! Funnily enough the code works fine when index to the first row. Will investigate.

@cvanelteren

Copy link
Copy Markdown
CollaboratorAuthor

Found the issue; it was feeding back into tight layout causing the figure to act as if the text was still there, overinflating the hspace.

@cvanelteren

Copy link
Copy Markdown
CollaboratorAuthor

Good catch @gepcel

@cvanelteren
cvanelteren merged commit a1bb307 into mainApr 7, 2026
16 of 19 checks passed
@cvanelteren
cvanelteren deleted the feature/shared-subplot-title branch April 7, 2026 22:33
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@cvanelteren@gepcel@beckermr