Skip to content

Use format() for shared subplot slice titles#652

Open
cvanelteren wants to merge 6 commits intomainfrom
feature/shared-subplot-title
Open

Use format() for shared subplot slice titles#652
cvanelteren wants to merge 6 commits intomainfrom
feature/shared-subplot-title

Conversation

@cvanelteren
Copy link
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
Collaborator Author

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

@codecov
Copy link

codecov bot commented Mar 21, 2026

Codecov Report

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

Files with missing lines Patch % Lines
ultraplot/figure.py 70.29% 17 Missing and 13 partials ⚠️
ultraplot/gridspec.py 93.93% 1 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@gepcel
Copy link
Collaborator

gepcel commented Mar 22, 2026

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

@cvanelteren
Copy link
Collaborator Author

@gepcel do you have an example?

@cvanelteren
Copy link
Collaborator Author

import ultraplot as uplt

# Test whether ignored for bar plots
fig, 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
Collaborator Author

image

@gepcel
Copy link
Collaborator

gepcel commented Mar 22, 2026

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

@cvanelteren
Copy link
Collaborator Author

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

@cvanelteren
Copy link
Collaborator Author

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
Collaborator Author

Good catch @gepcel

Sign up for free to 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.

3 participants