Skip to content

Fix: axes aspect shifting on pixel snapping after drawn#680

Merged
cvanelteren merged 7 commits intomainfrom
fix/issue-679-aspect-alignment
Apr 13, 2026
Merged

Fix: axes aspect shifting on pixel snapping after drawn#680
cvanelteren merged 7 commits intomainfrom
fix/issue-679-aspect-alignment

Conversation

@cvanelteren
Copy link
Copy Markdown
Collaborator

@cvanelteren cvanelteren commented Apr 13, 2026

Closes #679 by restoring alignment for mixed-span subplot layouts when one one of the axes uses a fixed aspect ratio. The regression showed up in arrangements like [[1, 2], [1, 3]], where an equal-aspect axis on the left would shrink inside its gridspec slot but the stacked axes on the right would keep their full vertical extent and visibly stick out above and below it. This change teaches the figure layout pass to propagate the aspect-constrained bounds across the neighboring subplots that share the same span, and adds a regression test for both the legacy and UltraLayout code paths so the layout stays visually consistent going forward.

…n one of the axes uses a fixed aspect ratio. The regression showed up in arrangements like [[1, 2], [1, 3]], where an equal-aspect axis on the left would shrink inside its gridspec slot but the stacked axes on the right would keep their full vertical extent and visibly stick out above and below it. This change teaches the figure layout pass to propagate the aspect-constrained bounds across the neighboring subplots that share the same span, and adds a regression test for both the legacy and UltraLayout code paths so the layout stays visually consistent going forward.
@cvanelteren cvanelteren requested a review from Copilot April 13, 2026 00:50
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 13, 2026

Codecov Report

❌ Patch coverage is 96.35922% with 15 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
ultraplot/figure.py 85.14% 10 Missing and 5 partials ⚠️

📢 Thoughts on this report? Let us know!

@cvanelteren
Copy link
Copy Markdown
Collaborator Author

need to fix the code patch and refactor some of this but otherwise LGTM.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a regression where mixed-span subplot mosaics (e.g. [[1, 2], [1, 3]]) become visually misaligned after draw when a spanning axes uses a fixed aspect ratio, by propagating the aspect-constrained bounds to adjacent sibling subplots.

Changes:

  • Add Figure._align_aspect_constrained_axes() to remap sibling subplot slots onto the post-apply_aspect() box for spanning fixed-aspect axes.
  • Invoke the new alignment step during Figure.auto_layout() after both the aspect and tight layout passes.
  • Add a regression test covering both legacy and UltraLayout code paths.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
ultraplot/figure.py Adds aspect-constrained span alignment logic and integrates it into the auto-layout pipeline.
ultraplot/tests/test_ultralayout.py Adds regression coverage for the mixed-span + fixed-aspect alignment behavior across layout engines.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@cvanelteren
Copy link
Copy Markdown
Collaborator Author

Regression is not caused by this PR -- merging.

@cvanelteren cvanelteren merged commit 97feb21 into main Apr 13, 2026
18 of 19 checks passed
@cvanelteren cvanelteren deleted the fix/issue-679-aspect-alignment branch April 13, 2026 06:50
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.

Unaligned subplot axes using GridSpec geometry

2 participants