-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
problem with time axis values in line plot #4401
Comments
Thanks for raising this @klindsay28; very clean example. This looks like an import cftime
import matplotlib.pyplot as plt
import nc_time_axis
time_vals = [cftime.DatetimeNoLeap(1+year, 1+month, 15)
for year in range(3) for month in range(12)]
x_vals = [time_val.year + time_val.dayofyr / 365.0
for time_val in time_vals]
fig, ax = plt.subplots(1, 1)
ax.plot(time_vals, x_vals, "-o") I'll do some further work to try and diagnose what the issue is there. |
I looked into the We can see the ticks are really 0000-12-01, 0001-10-01, 0002-08-01, and 0003-06-01. The main problem, I think, is that I opened an issue in |
This will be fixed in the next release of nc-time-axis, so I will go ahead and close this issue. Thanks for your patience @klindsay28. |
nc-time-axis version 1.4.0 has now been released and is available on both PyPI and conda-forge. It fixes this issue and a number of others -- see the newly added release notes and documentation for more information. |
When I run the following code inside a jupyter notebook, the values on the x axis (
time
) in the generated plot, inserted after the code, appear to run from 0 to ~4.I expect them to run from 1 to 4, like the
time
values do.I can't tell if this is a problem with what
xarray
passes tonc_time_axis
, or if it's a problem withnc_time_axis
itself.Could this be looked into please?
Environment:
Output of xr.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.7.8 | packaged by conda-forge | (default, Jul 31 2020, 02:25:08)
[GCC 7.5.0]
python-bits: 64
OS: Linux
OS-release: 3.10.0-1127.13.1.el7.x86_64
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8
libhdf5: 1.10.6
libnetcdf: 4.7.4
xarray: 0.16.0
pandas: 1.1.1
numpy: 1.19.1
scipy: 1.5.2
netCDF4: 1.5.4
pydap: None
h5netcdf: None
h5py: None
Nio: None
zarr: 2.4.0
cftime: 1.2.1
nc_time_axis: 1.2.0
PseudoNetCDF: None
rasterio: None
cfgrib: None
iris: None
bottleneck: 1.3.2
dask: 2.14.0
distributed: 2.14.0
matplotlib: 3.3.1
cartopy: 0.18.0
seaborn: 0.10.1
numbagg: None
pint: 0.15
setuptools: 49.6.0.post20200814
pip: 20.2.2
conda: None
pytest: 6.0.1
IPython: 7.17.0
sphinx: None
The text was updated successfully, but these errors were encountered: