pydata / pydata/xarray

Plotting with timedelta64 axis

Open
#2,898 1 comment 0 reactions 0 assignees View on GitHub

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()

Screenshot from 2019-04-16 05-17-54

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.