plotly / plotly/plotly.py

Weird Sankey cycles when nodes are positionned and not ordered by increasing x values

オープン
#3,568 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

bug P3
主要言語
Python
スター
18.8k
フォーク
2.8k
平均マージ
16時間 26分
マージ済み PR(30日)
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.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

Issue にある最小限の Python Sankey 例から始め、2 つのノードの x 順序を比較します。Sankey のレンダリングパスを追跡して、位置が逆になるとなぜ壊れたループ矢印が生成されるのかを特定します。両方の順序で、呼び出し元がノードを並べ替える必要なくサイクルが正しくレンダリングされれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
data-visualization
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。