plotly / plotly/plotly.py

px.area() ignores color_discrete_sequence or color_discrete_map when mode='none'

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

@LiamConnors がすでに取り組んでいます。

2024年7月4日 から。

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

説明

If I want to display just the shaded area in px.area(), without the top line, by specifying mode='none', the colors set with color_discrete_sequence or color_discrete_map are ignored. Instead, default colors of the template fig.layout.template.layout.colorway are used.

import plotly.express as px
import pandas as pd

fig = px.area(
    pd.DataFrame(
        index=[1,2,3],
        data={
            'x': [6,7,8],
            'y': [4,5,4],
        }
    ),
    color_discrete_map={
        'x': '#9467BD',
        'y': '#8C564B',
    },
)

fig.show()

1

If I add

fig.update_traces(
    mode='none',
)

I get wrong colors
2

I would expect px.area() to preserve the colors used for shading as they appear in fig.data:

     'line': {'color': '#9467BD'},
     'mode': 'none',
     'line': {'color': '#8C564B'},
     'mode': 'none',

Without this preservation, px.area() loses functionality for color mapping with color_discrete_map.

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

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

はじめの一歩

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

評価

この issue はまだ評価されていません。

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

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