Skip to content

Conversation

cvanelteren
Copy link
Collaborator

This PR introduces support for plotting data with non-standard calendars using cftime.

Key changes:

  • Added CFTimeConverter to enable matplotlib to handle cftime.datetime objects.
  • Implemented AutoDatetimeLocator and AutoDatetimeFormatter for automatic, "nice" tick generation on cftime axes, mimicking matplotlib's behavior for standard datetime objects.
  • Added a regression test using pytest-mpl to ensure visual consistency of plots with non-standard calendars.

This resolves issues where plots with non-standard calendars had incorrect or poorly formatted time axes.

Continuation of #289

image

Copilot

This comment was marked as resolved.

cvanelteren and others added 3 commits September 10, 2025 12:16
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link

codecov bot commented Sep 10, 2025

Codecov Report

❌ Patch coverage is 77.13816% with 139 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
ultraplot/ticker.py 66.98% 63 Missing and 41 partials ⚠️
ultraplot/tests/test_tickers.py 89.92% 20 Missing and 8 partials ⚠️
ultraplot/internals/rcsetup.py 53.33% 4 Missing and 3 partials ⚠️

📢 Thoughts on this report? Let us know!

@cvanelteren
Copy link
Collaborator Author

cvanelteren commented Sep 10, 2025

Still fixing one test but rest should be ready for review.

@cvanelteren cvanelteren force-pushed the feat-add-no-greg-timeformatting branch from bd5c2df to dda122a Compare September 10, 2025 11:46
@cvanelteren
Copy link
Collaborator Author

cvanelteren commented Sep 11, 2025

We may want to style the formatting further. In particular this

_RESOLUTION_TO_FORMAT = {
    "SECONDLY": "%H:%M:%S",
    "MINUTELY": "%H:%M",
    "HOURLY": "%Y-%m-%d %H:%M",
    "DAILY": "%Y-%m-%d",
    "MONTHLY": "%Y-%m",
    "YEARLY": "%Y",
}

@cvanelteren cvanelteren requested a review from Copilot September 11, 2025 07:59
Copilot

This comment was marked as resolved.

@cvanelteren cvanelteren force-pushed the feat-add-no-greg-timeformatting branch from d996c73 to febd860 Compare September 11, 2025 08:05
@cvanelteren cvanelteren added this to the v1.65.0 milestone Sep 11, 2025
@cvanelteren cvanelteren force-pushed the feat-add-no-greg-timeformatting branch from 41e6350 to 9e76c41 Compare September 11, 2025 09:30
@cvanelteren
Copy link
Collaborator Author

Got the coverage to 65 percent from 0. Little bit done with adding tests and this should be good enough for now.

Co-authored-by: Matthew R. Becker <beckermr@users.noreply.github.com>
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

cvanelteren and others added 2 commits September 30, 2025 18:56
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Collaborator

@beckermr beckermr left a comment

Choose a reason for hiding this comment

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

One more question. Looking good!

@cvanelteren
Copy link
Collaborator Author

Maybe I will add a bit more tests in the next few days but otherwise this is good to go.

@cvanelteren
Copy link
Collaborator Author

cvanelteren commented Oct 5, 2025

Autoformatting prefix and suffix are bugged. Will do this in another PR. I think the coverage is now 78% which is good enough for now. Will wait for codecov confirmation

@cvanelteren cvanelteren merged commit 08a6b2b into Ultraplot:main Oct 5, 2025
24 of 25 checks passed
@cvanelteren cvanelteren deleted the feat-add-no-greg-timeformatting branch October 5, 2025 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants