Skip to content

Conversation

@cvanelteren
Copy link
Collaborator

@cvanelteren cvanelteren commented Dec 14, 2025

Closes #297

This PR introduces UltraLayout, a novel constraint-based layout system using kiwisolver that enables aesthetically pleasing positioning for non-orthogonal subplot arrangements (e.g., [[1, 1, 2, 2], [0, 3, 3, 0]] where subplot 3 should be centered between subplots 1 and 2). The existing gridspec works great for orthogonal layouts but fails to produce visually balanced results when subplots span multiple rows/columns in non-aligned ways. UltraLayout automatically detects non-orthogonal layouts, applies constraint satisfaction to compute optimal positions that respect spacing, ratios, and aesthetic balance (e.g., centering subplots between neighbors), and gracefully falls back to the standard grid layout if kiwisolver is not installed or for orthogonal arrangements. This enhancement is fully backward compatible, adds zero overhead for standard grid layouts, includes comprehensive test coverage in ultraplot/tests/test_ultralayout.py, and provides a foundation for more sophisticated layout constraints in the future.

@cvanelteren cvanelteren changed the title Add kiwisolver-based constraint layout for non-orthogonal subplot arrangements Add UltraLayout: Advanced constraint-based positioning for non-orthogonal subplot arrangements Dec 14, 2025
@cvanelteren cvanelteren marked this pull request as draft December 14, 2025 07:53
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.

Colorbar not aligning with custom layout

2 participants