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