Bug: leftover xaxis entries when toggling between buttons
オープン
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 18.8k
- フォーク
- 2.8k
- 平均マージ
- 16時間 26分
- マージ済み PR(30日)
- 21
説明
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).
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
提供された Python MWE を実行し、subplot figure 内の option1 ボタンと option2 ボタンを切り替えることから始めます。traces が非表示になったときに共有 x 軸エントリがどのように保持されるか、また option1 と option2 がラベル B を共有している場合にどうなるかを確認します。option2 に切り替えたとき、option1 の残りの C x 軸エントリが表示されなくなれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- data-visualization
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 活発
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 55/100