Bug: leftover xaxis entries when toggling between buttons
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 新手友好度
- 55/100
- Issue 類型
- 缺陷
- 描述清晰度
- 基本清楚
- 活躍度
- 活躍
- 技術堆疊
- python
研究方向
首先執行提供的 Python MWE,並在 subplot 圖中切換 option1 和 option2 按鈕。檢查隱藏 traces 時共用的 x 軸項目如何被保留,以及這些選項共用標籤 B 時的情況。完成標準是:切換到 option2 後,不再顯示 option1 遺留的 C x 軸項目。
由索引模型根據 Issue 內容生成。
描述
Minimum Working Example (MWE):
import plotly.graph_objects as go
from plotly.subplots import make_subplots
# Data
option1_x = ['A', 'B', 'C']
option1_y1 = [1, 3, 2]
option1_y2 = [2, 4, 3]
option2_x = ['B', 'D', 'E']
option2_y1 = [2, 1, 4]
option2_y2 = [3, 2, 5]
# Create subplots
fig = make_subplots(rows=2, cols=1, shared_xaxes=True, subplot_titles=("y1", "y2"))
# Add traces for option1
fig.add_trace(go.Bar(x=option1_x, y=option1_y1, name="option1_y1"), row=1, col=1)
fig.add_trace(go.Bar(x=option1_x, y=option1_y2, name="option1_y2"), row=2, col=1)
# Add traces for option2
fig.add_trace(go.Bar(x=option2_x, y=option2_y1, name="option2_y1"), row=1, col=1)
fig.add_trace(go.Bar(x=option2_x, y=option2_y2, name="option2_y2"), row=2, col=1)
# Initially set option1 visible and option2 invisible
for trace in fig.data:
trace.visible = False
fig.data[0].visible = True # y1 option1
fig.data[1].visible = True # y2 option1
# Add buttons
fig.update_layout(
updatemenus=[
{
"type": "buttons",
"buttons": [
{
"label": "option1",
"method": "update",
"args": [
{"visible": [True, True, False, False]}, # Show only option1 traces
]
},
{
"label": "option2",
"method": "update",
"args": [
{"visible": [False, False, True, True]}, # Show only option2 traces
]
}
],
"showactive": True,
}
],
)
fig.show()
Toggling to option2, we can see the C xaxis entry (from option1) still showing (even with no data for it):
This seems to only be an issue with subplots, and when the traces of different options have some xaxis labels in common (in this case B).
- 主要語言
- Python
- 星號
- 18.8k
- 分支
- 2.8k
- 平均合併
- 13 小時 28 分鐘
- 30 天內合併 PR
- 20
環境準備
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
plotly/plotly.py 的其他 Issue
-
P3 size: 1 task
難度 2/5 1-3 小時 新手友好度 65/100
plotly/plotly.py#5769 · 1 個 reaction ·
維護者通常 1 天內回覆
-
P3 size: 1 task
難度 2/5 1-3 小時 新手友好度 72/100
維護者通常 1 天內回覆
-
bug P1
難度 1/5 1 小時以內 新手友好度 68/100
維護者通常 1 天內回覆
-
feature P3
難度 2/5 1-3 小時 新手友好度 62/100
維護者通常 1 天內回覆
-
feature P3
難度 2/5 1-3 小時 新手友好度 72/100
plotly/plotly.py#3859 · 1 則留言 ·
維護者通常 1 天內回覆
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 74/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 84/100
gradio-app/gradio#13895 ·
維護者通常 1 天內回覆
-
build-error
難度 2/5 1-3 小時 新手友好度 76/100
spack/spack-packages#6713 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 72/100
ActivityWatch/activitywatch#1464 · 1 個 reaction ·
維護者通常 1 天內回覆
-
[Bug]: The ckg tool drops the return type of every decorated Python method in class search results未關閉
難度 2/5 1-3 小時 新手友好度 78/100
bytedance/trae-agent#483 ·
維護者通常 1 天內回覆