Order of marginal wrong when using facet_col and setting traces to invisible by default
オープン
まだ誰も着手していません。
bug
P3
- 主要言語
- Python
- スター
- 18.8k
- フォーク
- 2.8k
- 平均マージ
- 16時間 26分
- マージ済み PR(30日)
- 21
説明
I am creating a histogram plot using plotly express.histogram, like the following:
df = pd.DataFrame({
'month': [5] * 30 + [6] * 30 + [7] * 30,
'value': np.random.randint(0, 100, size=90),
'Module': ['M', 'P']*45,
})
fig = px.histogram(
df,
x='value',
opacity=0.8,
color='month',
category_orders={'month': df['month'].sort_values(ascending=True)},
marginal='box',
barmode='overlay',
facet_col='Module',
)
for trace in fig.data:
if int(trace.name) not in (7,6):
trace.visible = "legendonly"
fig.show()
When I then want to show month 5 as well, the box in marginal is placed at the top of the others, giving the wrong order of month: 5, 7, 6 (red from top to bottom).
The problem does not appear when I don't use the facet_col argument, or when i show all month from the beginning (simply comment the part where i set trace.visible to legendonly).
plotly version: 5.18.0
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、提供されている plotly.express.histogram の例を plotly 5.18.0 で実行し、トレースを legendonly に設定した場合と、すべてのトレースを表示した場合で、facet_col と marginal の動作を比較します。marginal の box の順序がどのように生成されるかを追跡し、month 5 を表示してもカテゴリの順序 5, 6, 7 が維持されることを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- data-visualization
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100