plotly / plotly/plotly.py

Improper Sankey rendering for certain minimal topologies with loops

Open
#3,587 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug P3
Dominant language
Python
Stars
18.8k
Forks
2.8k
Avg merge
16h 26m
Merged PRs (30d)
21

Description

Sankey engine fails to correctly draw certain graphs containing loops. Attached is a minimal example containing 4 nodes and 5 traces. If any trace value is set to 0, the graph renders correctly.

Tested in python on plotly 5.5.0

import plotly.graph_objects as go
nodes = {'label': ['node 0', 'node 1', 'node 2', 'node 3']}
links = {'source': [0, 1, 2, 2, 3], 'target': [3, 0, 0, 3, 2], 'value': [1, 1, 1, 1, 1]}
go.Figure(go.Sankey(node=nodes, link=links)).show()

bad_sankey

In the correct rendering, the trace connecting node 2 to node 0 should be straight across.

This may be related to https://github.com/plotly/plotly.py/issues/3568

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 minimal Python Sankey example in the issue and compare its rendering when all link values are 1 versus when one value is 0. Review the related issue #3568 for context, then trace the Sankey rendering path to determine why the node 2 to node 0 link is not straight; done means the supplied topology renders correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.