Plotting with timedelta64 axis
Open
Nobody has claimed this yet.
topic-plotting
- Dominant language
- Python
- Stars
- 4.2k
- Forks
- 1.4k
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 14
Description
Pandas plotting has nice handling of timedelta64 axes - xarray seems to just plot these as integer nanoseconds. Would be great to have this functionality in xarray:
data = xr.DataArray(np.random.random(100), coords=[('td', np.arange(np.timedelta64(0), np.timedelta64(10, 'h'), np.timedelta64(6, 'm')))])
data.plot.line(x='td')
plt.figure()
data.to_pandas().plot()

Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the DataArray.plot.line call shown in the issue and compare its timedelta64-axis behavior with the pandas plotting example. The work is done when xarray plots timedelta64 coordinates with readable timedelta-aware axis handling instead of integer nanoseconds.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- matplotlib, numpy, pandas, python
- Domain
- data-visualization
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100