plotly / plotly/plotly.js

Filled area in scatterplot does not honor null values

Open
#7,448 2 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug P2
Dominant language
JavaScript
Stars
18.3k
Forks
2k
Avg merge
2d 12h
Merged PRs (30d)
28

Description

Opening a new issue as requested here: https://github.com/plotly/plotly.js/issues/1132

When the scatter plot has null values on the y axis, the line drawn by plotly.js is disconnected over this area as expected. However, with fill: 'tozeroy', the filled area still spans the area with null values instead going only from known values to zero.

Short example, can be seen here: https://www.fi.muni.cz/~kas/plots/plotly-issue-7448.html

Plotly.newPlot('somediv', [{
  type: "scatter",
  mode: "lines",
  x: [1,2,3,4,5],
  y: [1,2,null,2,1],
  fill: 'tozeroy',
}]);

In this example, there is no line drawn beetween (x=2, y=2) and (x=4, y=2) points as expected. There should be no filled area between x = 2 and x = 4 as well.

Thanks!

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 provided Plotly.newPlot reproduction and trace the scatterplot fill handling for null y values. The fix is complete when fill: 'tozeroy' leaves the interval between x=2 and x=4 unfilled while preserving the expected disconnected line behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.