Restyle function breaks "scatter" traces at the "h" orientation
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
If you set the orientation: 'h' to restyle (or update) function, then the "scatter" traces somehow shift relative to each other.
Not reproduce for "bar" traces.
Excemple on codepen:
var x = [1, 2, 3, 4, 5],
y = [0, 1, 2, 3, 4];
var traceCommon = {
//type: 'bar',
type: 'scatter',
orientation: "h",
stackgroup: "s",
mode: 'lines+markers',
x: x,
y: y
};
var trace1 = {
...traceCommon,
//y: [0, 1, 2, 3, 4],
//x: [1, 5, 3, 7, 5]
};
var trace2 = {
...traceCommon,
//y: [1, 2, 3, 4, 5],
//x: [4, 0, 4, 6, 8],
};
Plotly.newPlot('myDiv', [trace1, trace2], { title: { text: "OK" } });
setTimeout(() => {
Plotly.update('myDiv', {
x: [x, x],
y: [y, y],
orientation: ["h", "h"]
}, {
title: { text: "ERROR" }
}, [0, 1]);
}, 1500);
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
Reproduce the CodePen example using Plotly.update with two horizontal scatter traces and compare it with the commented bar-trace variant. Start at the Plotly.update/restyle entry points and trace how orientation and stackgroup are recalculated for scatter traces. Done means updating both traces no longer shifts them relative to each other while preserving the bar behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100