Visitar URL original
DOC: Note AutoDateLocator date precision limits in units guide by vineoy · Pull Request #32566 · matplotlib/matplotlib · GitHub
Skip to content

DOC: Note AutoDateLocator date precision limits in units guide - #32566

Open
vineoy wants to merge 2 commits into
matplotlib:mainfrom
vineoy:docs-autodatelocator-precision
Open

vineoy wants to merge 2 commits into
matplotlib:mainfrom
vineoy:docs-autodatelocator-precision

Conversation

@vineoy

@vineoy vineoy commented Nov 2, 2026 •

Copy link
Copy Markdown

PR summary

Following review feedback, the AutoDateLocator documentation now carries a short one-line note on the precision limits of matplotlib dates, linking to the explanation in the Plotting dates and strings explainer (galleries/users_explain/axes/axes_units.py), which is where the detailed discussion now lives. The original scope followed timhoffm's suggestion in #23493.

Because matplotlib dates are stored as floats of days since the epoch, nanosecond range timestamps lose their detail: close values collapse and the autoscaled view then spans years. I reproduced this locally and plotting the elapsed time as numpy.timedelta64 values gives a usable axis. The explainer section documents these limits and the options and links to the existing Date precision and epochs example.

Closes #23493

AI Disclosure

I used an AI coding assistant to explore the codebase and to run local experiments that verified the behavior documented here. I reviewed the docstring note and this PR text before submitting and the pre-commit checks pass locally on this branch.

PR quality check

  • Use an expressive title, e.g. "Fix title font property precedence"
  • [N/A] New and changed code is tested (docstring only, no code change)
  • [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

@github-actions

github-actions Bot commented Nov 2, 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.

@timhoffm timhoffm 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.

I'd rather have this explained in https://matplotlib.org/stable/users/explain/axes/axes_units.html

The note here should be shortend to something like

Date resolution is limited to approximately a microsecond. For details see [link].

Move the detailed explanation of Date resolution limits from the
AutoDateLocator docstring to the "Plotting dates and strings" explainer
page, and shorten the docstring note to a single sentence that links
there, as suggested in the review.
@github-actions github-actions Bot added the Documentation: user guide files in galleries/users_explain or doc/users label Nov 3, 2026
@vineoy vineoy changed the title DOC: Note AutoDateLocator date precision limits DOC: Note AutoDateLocator date precision limits in units guide Nov 3, 2026
@vineoy

vineoy commented Nov 3, 2026 •

Copy link
Copy Markdown
Author

Done in e1c73ea - the AutoDateLocator note is now the shortened one-liner linking to the guide and the detailed explanation (including the nanosecond-timestamp example and the timedelta64 / set_epoch options) moved to the Date conversion section of the "Plotting dates and strings" explainer (galleries/users_explain/axes/axes_units.py).

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Plotting of Pandas DataFrame data with nanosecond timestamps

2 participants