Thanks to visit codestin.com
Credit goes to github.com

Skip to content

DOC: annotation coords are not floats #24643

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
Dec 6, 2022

Conversation

rcomer
Copy link
Member

@rcomer rcomer commented Dec 6, 2022

PR Summary

There may be a better way to phrase than what I have done here, but I'm pretty sure (float, float) is wrong. The more detailed description for xycoords within the Annotation docstring states that it can be

A tuple (xcoords, ycoords) specifying separate coordinate systems for x and y. xcoords and ycoords must each be of one of the above described types.

PR Checklist

Documentation and Tests

  • [N/A] Has pytest style unit tests (and pytest passes)
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).
  • [N/A] New plotting related features are documented with examples.

Release Notes

  • [N/A] New features are marked with a .. versionadded:: directive in the docstring and documented in doc/users/next_whats_new/
  • [N/A] API changes are marked with a .. versionchanged:: directive in the docstring and documented in doc/api/next_api_changes/
  • [N/A] Release notes conform with instructions in next_whats_new/README.rst or next_api_changes/README.rst

@tacaswell tacaswell modified the milestones: v3.7.0, v3.6.3 Dec 6, 2022
@@ -1243,12 +1243,12 @@ def __init__(self, offsetbox, xy,
is determined by *boxcoords*.

xycoords : str or `.Artist` or `.Transform` or callable or \
(float, float), default: 'data'
2-element tuple of these, default: 'data'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused since the default is a string and not a 2 element tuple- is this because we don't need to pass in a 2-tuple when the coordinate system is the same?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, exactly. See the AnnotationBBox demo, where some use a single string and some use two.

Copy link
Member

@story645 story645 Dec 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I didn't catch that this was a line continuation but I'm finding the 'these' so ambiguous that I'm I think extra confused so what about being annoyingly explicit, something like 'scaler or 2 element tuple of str, Artist, callable, or transform : default 'data' "

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about

xycoords : single or two-tuple of str, `.Artist`, `.Transform` or callable.  

@rcomer rcomer force-pushed the annotate-xycoords branch from 23c33f2 to 97e2184 Compare December 6, 2022 18:02
@story645 story645 merged commit be03643 into matplotlib:main Dec 6, 2022
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Dec 6, 2022
QuLogic added a commit that referenced this pull request Dec 6, 2022
…643-on-v3.6.x

Backport PR #24643 on branch v3.6.x (DOC: annotation coords are not floats)
@rcomer rcomer mentioned this pull request Dec 9, 2022
6 tasks
@ksunden ksunden mentioned this pull request Feb 20, 2023
6 tasks
@rcomer rcomer deleted the annotate-xycoords branch March 4, 2023 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants