Skip to content

Document and fix AngleAnnotation constructor default case of using the current Axes - #32179

Merged
QuLogic merged 1 commit into
matplotlib:mainfrom
simonaltrogge:patch-1
Aug 7, 2026
Merged

Document and fix AngleAnnotation constructor default case of using the current Axes#32179
QuLogic merged 1 commit into
matplotlib:mainfrom
simonaltrogge:patch-1

Conversation

@simonaltrogge

Copy link
Copy Markdown
Contributor

PR summary

The provided AngleAnnotation class is already designed such that the current Axes will be used by default if no Axes are passed explicitly. Document this behavior. Call annotate on the correctly initialized class attribute self.ax instead of the constructor argument ax, which is None in the default case.

AI Disclosure

No AI was used.

PR quality check

  • Use an expressive title, e.g. "Fix title font property precedence"
  • [N/A] New and changed code is tested
  • [N/A] Plotting related features are demonstrated in an example
  • [N/A] New features and API changes have release notes
  • Documentation complies with general and docstring guidelines

`AngleAnnotation` is already designed such that the current Axes will be used by default if no Axes are passed explicitly. Document this behavior. Call `annotate` on the correctly initialized class attribute `self.ax` instead of the constructor argument `ax`, which is `None` in the default case.
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

Thank you for opening your first PR into Matplotlib!

If you have not heard from us in a week or so, please leave a new comment below and that should bring it to our attention. Most of our reviewers are volunteers and sometimes things fall through the cracks. We also ask that you please finish addressing any review comments on this PR and wait for it to be merged (or closed) before opening a new one, as it can be a valuable learning experience to go through the review process.

You can also join us on discourse chat for real-time discussion.

For details on testing, writing docs, and our review process, please see the developer guide.
Please let us know if (and how) you use AI, it will help us give you better feedback on your PR.

We strive to be a welcoming and open project. Please follow our Code of Conduct.

@story645 story645 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the fix, was there anything (like weird behavior or the like) that led you to catch this mistake?

@QuLogic
QuLogic merged commit f8dd91f into matplotlib:main Aug 7, 2026
24 checks passed
@QuLogic QuLogic added this to the v3.11.2 milestone Aug 7, 2026
@QuLogic

QuLogic commented Aug 7, 2026

Copy link
Copy Markdown
Member

@meeseeksdev backport to v3.11.x

@simonaltrogge

Copy link
Copy Markdown
Contributor Author

Thanks for the fix, was there anything (like weird behavior or the like) that led you to catch this mistake?

My linter discovered it, actually. I adopted the class in my codebase and ty complained that "Attribute annotate is not defined on None in union Unknown | None". That is how it caught my attention.

story645 pushed a commit that referenced this pull request Aug 7, 2026
…fault case of using the current Axes (#32180)

Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants