plotly.graph_objects.sankey.node.Line does not work with an array of color
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 18.8k
- フォーク
- 2.8k
- 平均マージ
- 16時間 26分
- マージ済み PR(30日)
- 21
説明
Hi everyone,
The docs says that the argument color either takes a color or an array of colors. However, when I pass an array of colors, it always shows up black instead of the specified color. Here is a code example that does the bug :
import plotly.graph_objects as go
# define the node labels and colors
node_labels = ["A", "B", "C", "D"]
node_colors = ["red", "blue", "green", "purple"]
#Array of colors for the node's line
node_line_colors = ["black", "gray", "orange", "yellow"]
# define the links between the nodes
link_source = [0, 0, 1, 1, 2, 2]
link_target = [1, 2, 2, 3, 0, 3]
link_value = [8, 4, 2, 6, 10, 12]
# create the Sankey diagram
fig = go.Figure(data=[go.Sankey(
node=dict(
label=node_labels,
color=node_colors,
line=dict(
color=node_line_colors, # Colors I want to have for my diagram
width=10 # Bigger to properly see that the colors aren't here
)
),
link=dict(
source=link_source,
target=link_target,
value=link_value
)
)])
fig.show()
I also tried to manually add the colors like this instead of using the constructor :
fig.data[0]['node']['line']['color'] = node_line_colors
But the node's lines still show up black instead of coloried.
Expected result :
black line for A node,
gray line for B node,
green line for C node,
purple line for D node ;
Actual result :

Thanks,
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、提供されている go.Sankey の例を実行し、ドキュメントに記載された配列の動作と、描画されたノードの線を比較します。次に、Sankey コンストラクターに渡されたときに node.line.color がどのように扱われるかを追跡し、その後、期待される4色が対応するノードに描画されることを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- data-visualization
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100