plotly / plotly/plotly.py

textfont color ignored in Sankey diagram

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

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

bug P3
主要言語
Python
スター
18.8k
フォーク
2.8k
平均マージ
16時間 26分
マージ済み PR(30日)
21

説明

When specifying textfont in a Sankey diagram like this: textfont=dict(color="blue", size=50) the color is ignored, while size works correctly.

A MWE with two figures. The first one has black nodes and (tiny) text, which is correct.

fig_black = go.Figure(data=[
    go.Sankey(
        node=dict(
            pad=15,
            thickness=20,
            line=dict(color="black", width=0.5),
            label=["A1", "A2", "B1", "B2", "C1", "C2"],
            color="black"
        ),
        link=dict(
            source=[0, 1, 0, 2, 3, 3],  # indices correspond to labels, eg A1, A2, A2, B1, ...
            target=[2, 3, 3, 4, 4, 5],
            value=[8, 4, 2, 8, 4, 2]
        ),
        textfont=dict(color="black", size=10)
    ),
])
fig_black.update_layout(title_text="Black")
fig_black.show()
Screenshot 2020-09-02 at 02 49 36

The second one has blue nodes, which is correct, but the text is black when it should be blue.

fig_blue = go.Figure(data=[
    go.Sankey(
        node=dict(
            pad=15,
            thickness=20,
            line=dict(color="blue", width=0.5),
            label=["A1", "A2", "B1", "B2", "C1", "C2"],
            color="blue"
        ),
        link=dict(
            source=[0, 1, 0, 2, 3, 3],  # indices correspond to labels, eg A1, A2, A2, B1, ...
            target=[2, 3, 3, 4, 4, 5],
            value=[8, 4, 2, 8, 4, 2]
        ),
        textfont=dict(color="blue", size=50)
    ),
])
fig_blue.update_layout(title_text="Blue")
fig_blue.show()
Screenshot 2020-09-02 at 02 50 42

I'm using plotly version 4.9.0.

Is the color specification above wrong or is this a bug?

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

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

はじめの一歩

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

調査の方向性

提供された2つの図のSankey MWEをPlotly 4.9.0で再現し、機能しているテキストサイズと無視されているテキストカラーを比較します。Sankeyのtextfontの処理を追跡し、要求されたカラーがレンダリングされることを示すcoverageを追加します。このissueには、最初に取りかかるべきソースファイルもテストも記載されていません。

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

評価

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

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

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