plotly / plotly/plotly.py

node positions do not work with link value zero in Sankey

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

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

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

newplot(6)

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()

newplot(7)

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()

newplot(12)

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

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

はじめの一歩

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

調査の方向性

まず、提供されている Python Sankey の例を実行し、1つのリンクの値がゼロの場合の自由配置を比較します。Python の図の定義からノード位置を処理するコンポーネントまで、Sankey のレンダリング経路を追跡します。リンクがないノード、または値がゼロのリンクしかないノードでも手動座標が有効なままとなり、両方のケースを対象とする回帰テストがあることを完了条件とします。

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

評価

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

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

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