Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[BUG]: `sankey`: `node.x` / `node.y` of `0` is ignored

Open Beginner friendly
#8,150 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
75/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
d3, javascript

Research direction

Start in src/traces/sankey/render.js at the “Force node position” loop and check how it tests trace.node.x[p] and trace.node.y[p] for missing values. Reproduce with the supplied Plotly.newPlot example using arrangement: 'fixed'. Done when coordinates of 0 are respected and the sankey_x_y_with_arrows.json mock baseline is updated as needed.

Written by the indexing model from the issue text.

Description

bug P3 size: 1
Description

Node coordinates of 0 for node.x or node.yare ignored and the node gets positioned automatically.

Screenshots

With 0 coords:

Image

With close to 0 coords:

Image
Steps to reproduce
  • Open Plotly devtools and paste the following into browser devtools:
Plotly.newPlot('g', [{
  type: 'sankey',
  arrangement: 'fixed',
  node: {label: ['a', 'b', 'c'], x: [0, 0.5, 0.8], y: [0, 0, 0.7]},
  link: {source: [0, 1], target: [1, 2], value: [1, 1]}
}], {margin: {l: 0, r: 0, t: 0, b: 0}});
  • Note that the center of a is not in the top left corner of the plot
Notes
  • This issue stems from the fact that the "Force node position" loop in src/traces/sankey/render.js uses a truthy test (if(trace.node.x[p] && trace.node.y[p])), and 0 is falsy
  • The fix is to change the test for missing values to != null
  • The mock sankey_x_y_with_arrows.json sets y: [0, 0, 0], so the fix changes its baseline
  • Discovered while working on #7826
Dominant language
JavaScript
Stars
18.4k
Forks
2.1k
Avg merge
1d 9h
Merged PRs (30d)
12

Getting set up

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.

More from plotly/plotly.js

All issues in plotly/plotly.js

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.