plotly / plotly/plotly.py

legend_tracegroupgap doesn't work when legend_traceorder is used

未關閉
#3,801 2 則留言 1 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

bug P3 sev-4
主要語言
Python
星號
18.8k
分支
2.8k
平均合併
16 小時 26 分鐘
30 天內合併 PR
21

描述

Note: to reproduce, see here

The problem

Baseline

long_df = px.data.medals_long()

fig = px.bar(long_df, x="nation", y="count", color="medal", title="Long-Form")
fig.update_layout(width=680, height=480,)
fig.show()

works just fine:
newplot (3)

Increasing the gap works

long_df = px.data.medals_long()

fig = px.bar(long_df, x="nation", y="count", color="medal", title="Long-Form")
fig.update_layout(autosize=False, width=680, height=480, legend_tracegroupgap=50)
fig.show()

also works fine
newplot (4)

Increasing the gap & reversing doesn't work

long_df = px.data.medals_long()

fig = px.bar(long_df, x="nation", y="count", color="medal", title="Long-Form Input")
fig.update_layout(width=680,height=480, legend_traceorder="reversed", legend_tracegroupgap=50)
fig.show()

gives
newplot (5)

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

從連結的 Colab 重現開始,在 Plotly Python 入口中比較 legend_traceorder="reversed" 與 legend_tracegroupgap=50。追蹤這兩個版面配置屬性如何一同處理。完成標準是:反轉圖例 trace 順序後,設定的間距仍然可見。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
python
領域
data-visualization
Issue 類型
缺陷
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
38/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。