pydata / pydata/xarray

Dataset plot line

Open
#4,235 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement topic-plotting
Dominant language
Python
Stars
4.2k
Forks
1.4k
Avg merge
2d 15h
Merged PRs (30d)
14

Description

Is your feature request related to a problem? Please describe.

Dataset have one plotting method Dataset.plot.scatter. This uses matplotlb's ax.scatter which have a limited presentation configuration (eg linestyle and marker).
I have 2D X and Y data which I like to plot against each other. The DataArray.plot.line works well if I only use a 1D X data.

Describe the solution you'd like

A new plotting method Dataset.plot.line based on matplotlib's ax.plot which will allow me to plot 2D X and Y against each other with flexible presentation configuration. In other to be able to produce 1D lines, this must demand a required 3D dimension as an argument (eg a choice of hue, col or others).

I suspect that as increase in number of dimensions from 1D to 2D for both variables and later to ND, there will be many ways to interpret the arguments given to the plotting function,. However, the fact the method name is line in indicate that it must produce 1D lines, and use other dimensions to create other features such as legend or subplots.

Having seen the code for the Dataset.plot.scatter I am keen to submit a PR to add Dataset.plot.line.

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 by reading the existing Dataset.plot.scatter and DataArray.plot.line implementations, then inspect how matplotlib ax.plot arguments could support 2D X and Y data. Done means adding Dataset.plot.line with a defined required dimension argument and tests or examples showing 1D lines with the requested presentation configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.