-
Notifications
You must be signed in to change notification settings - Fork 19
Add UltraLayout: Advanced constraint-based positioning for non-orthogonal subplot arrangements #479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Made a local error with the history so this is a restored version of the old PR. |
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
|
@beckermr should we merge with dev first? This is such a large change that this warrants a 2.0 release I reckon. I played around with it locally during work but it is likely that some bugs will turn up. |
|
Does anyone use the dev version? We can merge there, but I doubt we're going to do a ton more testing just because we merged to dev. |
|
I don't -- initially I want to structure the testing by first making it upstream. But we now got in the flow of pushing to main and then releasing from there. I can give this a spin for a week and first focus on the extra plot types before merging this to main. Then we can work up to the v2.0 and leave this as is for now. I have some code locall that implements #472 and #458 is not that difficult to implement either (perhaps a few weeks at most, time permitting). I don't necessarily mind jumping from say a v1.7x to 2.0 but just wanted to touch base with you before shipping a buggy release. |
|
Alright. If we think this feature will be deferred to 2.0, then let's do the following:
|
|
Ok performed the actions you outlined and removed some stray branches on the remote (including dev as it was not used) |
Closes #297,#270
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 inultraplot/tests/test_ultralayout.py, and provides a foundation for more sophisticated layout constraints in the future.Make subplot param probes backend-safe:
GridSpec.get_subplot_paramsnow returns a read-only snapshot of our margins/spaces andlocally_modified_subplot_paramsreturns False. This keeps Positron/other backends from erroring while preserving our restriction on mutating Matplotlib’s subplot params.