🚀 Release: CFTime Support and Integration
Highlights
CFTime Axis Support:
We’ve added robust support for CFTime objects throughout ultraplot. This enables accurate plotting and formatting of time axes using non-standard calendars (e.g., noleap, gregorian, standard), which are common in climate and geoscience datasets.
Automatic Formatter and Locator Selection:
ultraplot now automatically detects CFTime axes and applies the appropriate formatters and locators, ensuring correct tick placement and labeling for all supported calendar types.
Seamless Integration with xarray:
These features are designed for direct use with xarray datasets and dataarrays. When plotting data with CFTime indexes, ultraplot will handle all time axis formatting and tick generation automatically—no manual configuration required.
Intended Use
This release is aimed at users working with climate, weather, and geoscience data, where time coordinates may use non-standard calendars. The new CFTime functionality ensures that plots generated from xarray and other scientific libraries display time axes correctly, regardless of calendar type.
Example Usage
import xarray as xr
import numpy as np
import cftime
import ultraplot as uplt
# Create a sample xarray DataArray with CFTime index
times = [cftime.DatetimeNoLeap(2001, 1, i+1) for i in range(10)]
data = xr.DataArray(np.random.rand(10), coords=[times], dims=["time"])
fig, ax = uplt.subplots()
data.plot(ax=ax)
# CFTime axes are automatically formatted and labeled
ax.set_title("CFTime-aware plotting with ultraplot")
uplt.show()Migration and Compatibility
- No changes are required for existing code using standard datetime axes.
- For datasets with CFTime indexes (e.g., from
xarray), simply plot as usual—ultraplotwill handle the rest.
We welcome feedback and bug reports as you explore these new capabilities!
What's Changed
- Fix edgecolor not set on scatter plots with single-row DataFrame data by @Copilot in #325
- Add suptitle_kw alignment support to UltraPlot by @Copilot in #327
- Update Documentation for
abcParameter in Subplots and Format Command by @cvanelteren in #328 - Fix subplots docs by @cvanelteren in #330
- Add members to api by @cvanelteren in #332
- rm show from tests by @cvanelteren in #335
- Revert "Fix edge case where vcenter is not properly set for diverging norms" by @beckermr in #337
- Bump the github-actions group with 2 updates by @dependabot[bot] in #339
- Extra tests for geobackends by @cvanelteren in #334
- Fix some links for docs by @cvanelteren in #341
- Fix links docs by @cvanelteren in #342
- Lazy loading colormaps by @cvanelteren in #343
- Set warning level for mpl to error by @cvanelteren in #350
- Sanitize pad and len formatters on Cartesian Axes by @cvanelteren in #346
- Fix order of label transfer by @cvanelteren in #353
- Bump the github-actions group with 2 updates by @dependabot[bot] in #354
- Add cftime support for non-standard calendars by @cvanelteren in #344
New Contributors
- @Copilot made their first contribution in #325
Full Changelog: v1.60.2...v1.61.0
Note: v1.61.0 is yanked from pypi as it contained a debug statement. This merely removes the debug.