Fix: axes aspect shifting on pixel snapping after drawn#680
Merged
cvanelteren merged 7 commits intomainfrom Apr 13, 2026
Merged
Fix: axes aspect shifting on pixel snapping after drawn#680cvanelteren merged 7 commits intomainfrom
cvanelteren merged 7 commits intomainfrom
Conversation
…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.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Collaborator
Author
|
need to fix the code patch and refactor some of this but otherwise LGTM. |
Contributor
There was a problem hiding this comment.
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.
Collaborator
Author
|
Regression is not caused by this PR -- merging. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.