Uh oh!
There was an error while loading. Please reload this page.
Fix: axes aspect shifting on pixel snapping after drawn - #680
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! |
cvanelteren
commented
Apr 13, 2026
need to fix the code patch and refactor some of this but otherwise LGTM. |
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.
Uh oh!
There was an error while loading. Please reload this page.
cvanelteren
commented
Apr 13, 2026
Regression is not caused by this PR -- merging. |
Uh oh!
There was an error while loading. Please reload this page.
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.