-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
Use annotate coordinate systems to simplify label_subplots. #25905
Conversation
galleries/examples/text_labels_and_annotations/label_subplots.py
Outdated
Show resolved
Hide resolved
galleries/examples/text_labels_and_annotations/label_subplots.py
Outdated
Show resolved
Hide resolved
fda95f2
to
6a6b401
Compare
Reordered the parameters; also switched to using "offset fontsize" in one of the two examples (thanks @saranti for pointing this out in #25907 (comment)) as that's the more natural unit here. |
# Put the label | ||
# - at the top left corner (axes fraction (0, 1)), | ||
# - offset half-a-fontsize right and half-a-fontsize down | ||
# (offset fontsize (+0.5, -0.5)), | ||
# i.e. just inside the axes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if this would be better in the text above instead of a comment, but unfortunately, the CI-built docs have been garbage-collected now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re-triggered a CI run.
Should still be good to go. |
I'm fine with this, and feel free to ping for a merge when docs finish. But, did you consider keeping both in the example? ScaledTranslation is useful for other things, so an intuitive application has some value, even if there is a nicer way to do that application? |
Fair point; I restored the use of ScaledTranslation for the second example (I don't think we need to have both versions for both examples, they are really the same). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason pre-commit needs to be appeased.
The ability of annotate to specify various coordinates systems simplifies label_subplots, by avoiding the need to explicitly construct a ScaledTranslation (while maintaining exact functionality parity).
Oops, sorry misclicked :/ and accidentally merged just after pushing the pre-commit fix. @jklymak let me know if there's anything else you think should be fixed. |
The ability of annotate to specify various coordinates systems simplifies label_subplots, by avoiding the need to explicitly construct a ScaledTranslation (while maintaining exact functionality parity).
PR summary
PR checklist