Scattergl doesn't fill to zero y (`tozeroy`) properly
Open
Nobody has claimed this yet.
bug
P3
- Dominant language
- JavaScript
- Stars
- 18.3k
- Forks
- 2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 28
Description
scatter works fine, but scattergl fills in a wrong way.
a simple demo:
<html>
<head>
<meta charset="utf-8"/>
<script src="https://cdn.plot.ly/plotly-2.6.3.min.js"></script>
<title>plotly tozeroy bug</title>
</head>
<body>
<div>
<div id="823f03ed-bb11-463b-94a1-dc14225efe68" class="plotly-graph-div" style="height:100%; width:100%;"></div>
<script type="text/javascript">
// prepare data
const x = [];
const y = [];
for (let i = -20; i < 20; i += 0.01) {
x.push(i);
y.push(Math.sin(i));
}
// plot to div
Plotly.newPlot("823f03ed-bb11-463b-94a1-dc14225efe68",
[
{
"type": "scatter",
"x": x,
"y": y,
"xaxis": "x",
"yaxis": "y",
"fill": "tozeroy"
},
{
"type": "scattergl",
"x": x,
"y": y,
"xaxis": "x2",
"yaxis": "y2",
"fill": "tozeroy"
}
],
{
"xaxis": {"anchor": "y", "domain": [0.0, 1.0]},
"yaxis": {"anchor": "x", "domain": [0.575, 1.0]},
"xaxis2": {"anchor": "y2", "domain": [0.0, 1.0]},
"yaxis2": {"anchor": "x2", "domain": [0.0, 0.425]},
"title": {"text": "Scatter vs. Scattergl, fill tozeroy"}
}
);
</script>
</div>
</body>
</html>
output:

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
Run the embedded HTML reproduction with the Plotly 2.6.3 CDN and compare the scatter and scattergl traces using fill: "tozeroy". Investigate the WebGL rendering path behind scattergl; done means its filled area reaches y=0 and matches the regular scatter result for the provided sine-wave data.
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
- 42/100