Let Axes.clear iterate over Axises. #23501
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
... so that the implementation also works for 3D. This means also
adding a sharez() method, which is copy-pasted from sharex()/sharey()
(note that it is resolves a slight inconsistency in the old
Axes3D.clear, which would previously not copy the z-autoscaleness status
of a z-shared axes).
Using Axis._set_lim in the loop also means that we need to pass auto
explicitly to it anyways (it is a required parameter), so we can get rid
of the set_autoscalex/y/z calls.
Also, note that Axis.clear() explicitly resets the scale to "linear", so
the extra
_set_scale("linear")
calls are unneeded.Finally, remove the silencing of TypeErrors when setting limits in
clear(), which was added in 917de33 to handle initialization order
problems in Axes3D but which seem not needed anymore (and are rather
unsightly, as it's not immediately clear what we're really catching).
PR Summary
PR Checklist
Tests and Styling
pytest
passes).flake8-docstrings
and runflake8 --docstring-convention=all
).Documentation
doc/users/next_whats_new/
(follow instructions in README.rst there).doc/api/next_api_changes/
(follow instructions in README.rst there).