Skip to content

Unify fig.delaxes(ax) and ax.remove(). #15290

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

Merged
merged 2 commits into from
Sep 20, 2019
Merged

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Sep 18, 2019

fig.delaxes(ax) and ax.remove() are subtly different because the former
fails to correctly reset locators and formatters when removing shared
axes. Fix that by putting the logic in delaxes and making ax.remove()
just map to it.

(We could even consider deprecating delaxes as Artist.remove() is the standard, generic way to remove any artist -- but let's not get into that discussion here :p)

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

fig.delaxes(ax) and ax.remove() are subtly different because the former
fails to correctly reset locators and formatters when removing shared
axes.  Fix that by putting the logic in delaxes and making ax.remove()
just map to it.
@anntzer
Copy link
Contributor Author

anntzer commented Sep 19, 2019

Added a second commit that switched the docs to use ax.remove() rather than delaxes(ax), too -- if a user learns artist.remove(), they know how to remove any artist, whereas if he learns delaxes(), they only know how to remove an axes.

@timhoffm
Copy link
Member

+/-0. This way, you have to know that the Axes is an Artist, which I also consider advanced knowledge. You already have my vote, so you may keep it including the new change.

@story645
Copy link
Member

Agree on ax.remove() being cleaner than delaxes/better way to document that functionality. (And as an aside, learned about this feature from this PR and already had a use case for it today. 😄

@anntzer
Copy link
Contributor Author

anntzer commented Sep 20, 2019

@story645 good to go? :)

@story645
Copy link
Member

Sorry am on phone & trying to at least not merge from mobile version of site anymore. Should this get milestoned to something?

@timhoffm timhoffm added this to the v3.3.0 milestone Sep 20, 2019
@timhoffm timhoffm merged commit c81a965 into matplotlib:master Sep 20, 2019
@anntzer anntzer deleted the delaxes branch September 20, 2019 21:30
@anntzer
Copy link
Contributor Author

anntzer commented Sep 20, 2019

No worries 🙂

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.

3 participants