node positions do not work with link value zero in Sankey
未关闭
还没有人认领这个 Issue。
bug
P3
- 主要语言
- Python
- 星标
- 18.8k
- 派生
- 2.8k
- 平均合并
- 16 小时 26 分钟
- 30 天内合并 PR
- 21
描述
Hello,
I'm new to the plot.ly lib but I already discovered an issue.
If there is a node with:
- no links
- only links with the value of zero
the manual positioning doesn't work anymore except if you delete the relating coordinates of this node and keep the node in the list (see third example).
Below you can find a short testing code with the generated output.
working example
import plotly.graph_objects as go
data=go.Sankey(
arrangement = "freeform",
node = {
"label": ["A", "B", "C", "D", "E", "F"],
"x": [0.2, 0.1, 0.9, 0.7, 0.3, 0.9],
"y": [0.1, 0.9, 0.2, 0.1, 0.9, 0.9],
'pad':100}, # 10 Pixels
link = {
"source": [0, 0, 1, 4, 4, 3, 3],
"target": [1, 3, 4, 3, 5, 2, 5],
"value": [3, 3, 5, 4, 10, 1, 7 ]})
fig_sankey = go.Figure(data=data)
fig_sankey.show()

node with only one link with value of zero
import plotly.graph_objects as go
data=go.Sankey(
arrangement = "freeform",
node = {
"label": ["A", "B", "C", "D", "E", "F"],
"x": [0.2, 0.1, 0.9, 0.7, 0.3, 0.9],
"y": [0.1, 0.9, 0.2, 0.1, 0.9, 0.9],
'pad':100}, # 10 Pixels
link = {
"source": [0, 0, 1, 4, 4, 3, 3],
"target": [1, 3, 4, 3, 5, 2, 5],
"value": [3, 3, 5, 4, 10, 0, 7 ]})
fig_sankey = go.Figure(data=data)
fig_sankey.show()

kind of working again cause coordinates of C are deleted
import plotly.graph_objects as go
data=go.Sankey(
arrangement = "freeform",
node = {
"label": ["A", "B", "C", "D", "E", "F"],
"x": [0.2, 0.1, 0.7, 0.3, 0.9],
"y": [0.1, 0.9, 0.1, 0.9, 0.9],
'pad':100}, # 10 Pixels
link = {
"source": [0, 0, 1, 4, 4, 3, 3],
"target": [1, 3, 4, 3, 5, 2, 5],
"value": [3, 3, 5, 4, 10, 0, 7 ]})
fig_sankey = go.Figure(data=data)
fig_sankey.show()

贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先运行提供的 Python Sankey 示例,并比较其中一个链接的值为零时的自由定位。跟踪 Sankey 的渲染路径,从 Python 图形定义到处理节点位置的组件。完成的标准是:对于没有链接或仅有值为零链接的节点,手动坐标仍然有效,并且有一个覆盖这两种情况的回归测试。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- data-visualization
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100