Mnt/no reset axes#24626
Conversation
df7fe30 to
5d60904
Compare
|
On consideration, this has sat for so long it can sit a bit longer. We have more than enough to try and get in for 3.7 so defer this to 3.8. |
|
Does this mean ArtistList does not work anymore? It seems like starting from 3.7.0, pop() function doesn't work on it... |
|
That has nothing to do with this PR; see https://matplotlib.org/stable/api/prev_api_changes/api_changes_3.7.0.html#modification-of-axes-children-sublists |
|
Ah ok, thank you. |
5d60904 to
4f8ec8e
Compare
4f8ec8e to
0c80e8e
Compare
This is exactly the sort of error that this check is supposed to catch.
0c80e8e to
e591c44
Compare
|
Is this really necessary? I could imagine a use case where one has a GUI with multiple Axes and functionality to move datasets across Axes. That would be significantly more complicated if one had to read all properties from an Artist and create a new one with the same properties. IMHO „ but it is not clear we actually do enough clean up to make these re-added Aritsts actually work.“ is not enough justification for prohibiting. It rather shows that our architecture is not clear. Overall, I suppose Artists hold little Axes-specific information, and I don’t see a fundamental blocker why we shouldn’t be able to systematically separate that. I‘d rather go with „re-adding is permitted but not well-tested behavior.“ and handle issues when they arise, either by fixing or by prohibiting re-use of specific Artists, when there are good reasons for it. |
ok, I'm sold on that. I've been dragging this PR along for a while now without thinking through why to begin with 🐑 . I think three things have changed in the last few years:
I'll go head and close this and we can use #31748 to sort out the current state. |
PR Summary
This makes our Artists very picky about being re-added to Axes / Figures once they have been removed. Currently there is enough checking in place that it should not be possible to try and add the Artist to more than one simultaneously, but it is not clear we actually do enough clean up to make these re-added Aritsts actually work. I suspect in most cases where users are removing / readding Aritsts they would be better off using
set_visible(), but I have no idea how common it actually is.Open questions:
ArtistListdeprecation to expire (if we are ever going to expire those)?I think this is sufficiently tested, but needs API change notes, but waiting for the above decisions before writing them.
In any case, the change to the OffsetBox test should probably be pulled out and if we do not take this, find a way to make that error out for maybe other reasons.
PR Checklist
Documentation and Tests
pytestpasses)Release Notes
.. versionchanged::directive in the docstring and documented indoc/api/next_api_changes/