Skip to content

ENH: fig.annotate - #28753

Draft
story645 wants to merge 1 commit into
matplotlib:mainfrom
story645:rainbow-fig
Draft

story645 wants to merge 1 commit into
matplotlib:mainfrom
story645:rainbow-fig

Conversation

@story645

@story645 story645 commented Aug 23, 2024 •

Copy link
Copy Markdown
Member

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

anntzer commented Aug 23, 2024

Copy link
Copy Markdown
Contributor

See also #25998.

@story645

Copy link
Copy Markdown
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
Copy Markdown
Member Author

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

@timhoffm

Copy link
Copy Markdown
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

story645 commented Aug 25, 2024 •

Copy link
Copy Markdown
Member Author

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
Copy Markdown
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

This branch has not been deployed

No deployments
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