Skip to content

Add explicit getters and setters for Annotation.anncoords. #12144

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 1 commit into from
Sep 18, 2018

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Sep 17, 2018

While we may, in some distant future, move to properties everywhere,
right now providing getters and setters allows for uniform code for
touching Artist properties.


  • I have a real use case in mplcursors for this feature :) (in the sense that it avoids some more hardcoding that anncoords are "special" as they are directly assigned instead of going through a setter).
  • I did not add getters and setters for xyann because they already have get_position/set_position.
  • In Annotation refactor #2351 @tacaswell renamed what was before the textcoords attribute to anncoords, but the keyword argument to the Annotation constructor was not changed (so it's still textcoords). I'd suggest renaming the constructor argument for consistency...

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

While we may, in some distant future, move to properties everywhere,
right now providing getters and setters allows for uniform code for
touching Artist properties.
@anntzer anntzer added this to the v3.1 milestone Sep 17, 2018
@timhoffm timhoffm merged commit 521b60a into matplotlib:master Sep 18, 2018
@anntzer anntzer deleted the anncoords-getset branch September 18, 2018 18:42
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