Skip to content

ENH: fig.annotate #28753

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

ENH: fig.annotate #28753

wants to merge 1 commit into from

Conversation

story645
Copy link
Member

@story645 story645 commented Aug 23, 2024

PR summary

Based on gitter convo w/ @tacaswell, the text.Annotation object is a really simple way to make rainbow figure text, so:

  • updated the rainbow text example to show how to do it for figures
  • updated the annotation tutorial to show how to use annotate objects and add them to the figure

PR checklist

@story645 story645 added topic: annotation Documentation: examples files in galleries/examples Documentation: user guide files in galleries/users_explain or doc/users labels Aug 23, 2024
@anntzer
Copy link
Contributor

anntzer commented Aug 23, 2024

See also #25998.

@story645
Copy link
Member Author

@anntzer yes I agree we should add a fig.annotate method.

Also this is lightweight enough that we should document how this works b/c I find the artist API just a bit intimidating.

…w texts

Co-authored-by: Thomas A Caswell <tcaswell@gmail.com>
@story645
Copy link
Member Author

also is the linting check running off main and so won't see this exception?

@timhoffm
Copy link
Member

Artist instantiation + add_artist should not be a first-class user-facing API. The standard pattern in matplotlib are functions to create the artists. I'd be very reluctant to dilute this. Frist and foremost I consider add_artist a low level API, that end-users should not have to use. It should be the very exception in examples and only show up in corner cases for which it is not worth having high-level API. If advertised in such a scenario, we should communicate that we use low-level API.

@story645
Copy link
Member Author

story645 commented Aug 25, 2024

Artist instantiation + add_artist should not be a first-class user-facing API. The standard pattern in matplotlib are functions to create the artists

So is that a second yes for @anntzer's proposal of a figure.annotate? As far as I can tell, the implementation is basically forward to artist + add artist to figure & if so I'll just update this PR to do that and then update these docs to show that.

I just wanted to document how you get figure level rainbow text and annotation b/c folks request it and I've needed at least the rainbow text a few times.

@tacaswell
Copy link
Member

Consensus on the call this week was to add Figure.annotate

@story645 story645 marked this pull request as draft August 29, 2024 19:52
@story645 story645 changed the title Doc: using text.Annotation for figure annotation ENH: fig.annotate Aug 29, 2024
@story645 story645 linked an issue Jan 24, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation: examples files in galleries/examples Documentation: user guide files in galleries/users_explain or doc/users topic: annotation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ENH]: Figure.annotate
4 participants