-
Notifications
You must be signed in to change notification settings - Fork 105
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
datetime locator doesn't work with cftime #126
Comments
Unfortunately this bug is related to the incompatibility of "cftime" axes with native matplotlib datetime locators, not a proplot bug: import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import numpy as np
import xarray as xr
times = xr.cftime_range('1990', '2000', freq='M')
data = xr.DataArray(
np.random.rand(len(times)),
dims=['time'],
coords=[times]
)
f, ax = plt.subplots()
ax.plot(data.time, data)
ax.xaxis.set_major_locator(mdates.YearLocator(1)) It appears the default locator for cftime axes is a special In [5]: ax.xaxis.get_major_locator()
Out[5]: <nc_time_axis.NetCDFTimeDateLocator at 0x1222c2898> And unforunately, the |
Thanks @lukelbd, I'll move this over there when I get a chance. |
I'm reopening this based on our discussion at SciTools/nc-time-axis#41. It looks like |
Works for me |
After the reorganization, the |
Code sample, a copy-pastable example if possible
Actual result vs. expected result
The x datetime axis appears by default (with the comments included above), but when using
ax.format(xlocator='year')
or any locator, the xticks and labeling completely disappear.When using any formatter (e.g.
xformatter='concise')
it breaks with the following error:The text was updated successfully, but these errors were encountered: