Skip to content

Suggest close-proximity property names on invalid Artist property - #32612

Open
adambernier wants to merge 3 commits into
matplotlib:mainfrom
adambernier:suggest-artist-property
Open

adambernier wants to merge 3 commits into
matplotlib:mainfrom
adambernier:suggest-artist-property

Conversation

@adambernier

@adambernier adambernier commented Nov 16, 2026 •

Copy link
Copy Markdown

PR summary

Instead of silently failing, as raised in pandas-dev/pandas#72090, suggest close-proximity property names using difflib.get_close_matches

These changes have virtually zero impact on Matplotlib's public API:

• No public API or signature changes
• Zero overhead on valid calls: lazy import of difflib only if an invalid property is passed
• Backward-compatible error: The same AttributeError(..., name=k) type, .name attribute, and existing message prefix are preserved, with only an optional: "Did you mean 'color'?" suffix appended when a close match is found e.g. "colour"

Closes #32611

AI Disclosure

Gemini Hydrogen was used to explore the issue, suggest the changes to make, & determine where the changes should be made

PR quality check

  • Use an expressive title, e.g. "Fix title font property precedence"
  • 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
  • [n/a] Documentation complies with general and docstring guidelines

@github-actions

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.

Comment thread lib/matplotlib/artist.py Resolved
Comment thread lib/matplotlib/artist.py Resolved
Comment thread lib/matplotlib/artist.py Resolved
Comment thread lib/matplotlib/artist.py Resolved
Comment thread lib/matplotlib/artist.py Resolved

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ENH]: Suggest close property matches ('Did you mean ...?') in Artist._update_props

3 participants