-
Notifications
You must be signed in to change notification settings - Fork 12
Feat more advanced sharing of axes. #244
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
|
I think the issue is that the mapping from sharing and sharee is exactly inverted in UltraPlot compared to matplotlib. This is not nessarily an issue, except that we cannot toggle the tick_params individually. This is what needs to be addressed here to properly fix it. Not sure yet how tho. |
I’m trying to track down a behavioral difference between UltraPlot and Matplotlib regarding axis sharing and tick label display. In Matplotlib, the shared and sharee roles appear to be the inverse of how UltraPlot handles them—but this doesn't seem to be the root cause of the issue I'm seeing. Here’s what I’ve found: in Matplotlib, we can control tick label visibility per subplot. For example, setting
results in the following output: However, doing the same in UltraPlot does not show the tick labels: Now that I think about it, this might actually be due to how the shared axes are set up. In Matplotlib, the top-left subplot (ax[0, 0]) does not share its axis with any other subplot (i.e., its .sharex and .sharey are None). In UltraPlot, however, those attributes are not None—which might suppress the label rendering. When I manually set the shared axes for the top-left subplot in UltraPlot to None, the tick labels appear as expected. Could use your thoughts on this, @beckermr—does this sound like a difference in how the initial sharing is applied or propagated? |
TBH I don't know at all. :/ |
hmmm ok. We could revert the commit for now, but it is also broken in that state. I cannot directly see the difference that are apparent. I can at least state:
|
Found the issue in |
I need to move some logic there to the setup, and check whether it will affect downstream processing. But little later ;-)! |
I believe I got it working 🥳. The function Note that with this change, we can now modify the axes post creation which prevents a weird disconnect with behavior under matplotlib and under ultraplot. |
Codecov ReportAll modified and coverable lines are covered by tests ✅ 📢 Thoughts on this report? Let us know! |
Need to move some code around, but this is starting to look good: the problem is identified and we can solve this. |
I refactored the sharing and moved it into figure. I have in addition introduced some new functionality to utils for internal use. I further expanded the axes sharing to allow for subsharing depending on the axis type (geo, cartesian etc). It is in a rough state now and it drastically needs some tests, but I intend to move the sharing and turning on and off on label on figure creation, and or when all axes are formatted. This differs from the current implementation that forces everything on draw and limits the kinds of sharing that is allowed. It additionally creates a side effect where modifying singular subplots is not allowed. |
Some tests are still failing, but most of the pieces are in place now. Just need to check that on creation the sharing is called at an appropriate time. |
Need to fix an edge case where some plots are spanning another (or vice versa). For these cases the labels should be turned on. |
I guess the best approach would be to convert the crawler into something that check ranges. Then if the range is exactly the same to the left or right, we drop the label, otherwise we keep them on (same for top and bottom). |
Need to finalize this before I forget and become not merged in main. the main issue is that ultraplot currently works flawlessly for sharing bottom and left labels but fails to work for top right labels on regular grids and non regular layouts. I see the major issue can be encapsulated as:
I initially tries to solve the issue by inverting the sharing pattern, but this does not solve the issue as it will cause strange interactions with twinned axes and furthermore, will not work if all the labels are on. This would imply that we copy the logic for sharing and introduce |
Fixed issue where twinned axes reversed axis sharing: #233