Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork8.1k
TYPING: Broaden Axes.annotate xy/xytext types to allow datetime-like values (#30365)#30693
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
cnotley commentedOct 28, 2025
The failing check appears to be the first-interaction action complaining about a missing issue_message. This PR only updates the _axes.pyi stub for Axes.annotate and doesn’t touch code or CI |
rcomer commentedOct 28, 2025
Tests are failing because |
ksunden commentedOct 28, 2025
I think this needs to be amuch broader discussion than just about It was an intentional choice to go with I have had various thoughts about having a A more complicated option that I don't think I want to go with would be to make |
timhoffm commentedOct 31, 2025
I would not do any changes here for now based on
The rare other cases should just |
tacaswell commentedNov 2, 2025
This seems like a good option, but not sure how much work that is. I agree with Tim in teh short term we should document
|
PR summary
This updates the type hints for
Axes.annotateinlib/matplotlib/axes/_axes.pyiso that thexyandxytextparameters are no longer restricted totuple[float, float], but instead accepttuple[Any, Any].Why is this change necessary?
Axes.annotatesupports coordinates that are not just floats. A common example is using datetime-like values on the x-axis together with a float on the y-axis.xyandxytextastuple[float, float], which caused type checkers (e.g. mypy/pyright) to incorrectly flag valid code.What problem does it solve?
What is the reasoning for this implementation?
xy: tuple[Any, Any]xytext: tuple[Any, Any] | NoneTitle:
TYPING: Broaden Axes.annotate xy/xytext types to allow datetime-like values (#30365)PR checklist