Weird Sankey cycles when nodes are positionned and not ordered by increasing x values
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 18.8k
- 派生
- 2.8k
- 平均合并
- 16 小时 26 分钟
- 30 天内合并 PR
- 21
描述
I had some strange looking arrows in a Sankey (Plotly v 5.5.0), involving loops. The exact same problem was raised here. After trying different things, I found out the problem occured only when using node positions, and if the nodes in a given loop are not ordered by ascending 'x' position. You may give it a try with this very basic example:
import plotly.graph_objects as go
fig = go.Figure(go.Sankey(
node = {"label": ["First node", "Last node"],
"x": [0.6, 0.2],
"y": [0.2, 0.6]},
link = {
"source": [0, 1],
"target": [1, 0],
"value": [1, 1]
}))
fig.show()
And then replacing the "x" line by:
"x": [0.2, 0.6],
This looks like a bug, which should be fixed ideally. In the meantime, I strive to first order my nodes by ascending X position, which is rather tedious, since I already have to remove nodes without links (or 0 value links) as explained in other open issues. This involves quite a bit of pre-processing unfortunately.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 issue 中的最小 Python Sankey 示例开始,比较两种节点 x 顺序。跟踪 Sankey 渲染路径,以确定为什么反向位置会生成损坏的循环箭头;完成的标准是两种顺序都能正确渲染该循环,而不要求调用方重新排列节点。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- data-visualization
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100