I am trying to use a triplet of dropdowns to select 3 unique traces (column values) from a DataFrame and plot them on the same fig for comparison. The DataFrame has ~2500 entries so a dropdown would assist in historical comparison. Currently when I try adding multiple dropdowns updating one changes all the others so that only one trace is selected and shown
Sample Code
fig = go.Figure()
for dat in df.columns:
fig.add_trace(go.Scatter(x=df.index,y=df[dat],
visible=True,
marker=dict(size=12, line=dict(width=2)),
marker_symbol = ‘diamond’,name=str(dat)[:10]
)
)
updatemenu=
buttons=
for d in df.columns:
argList =
argList.append(df[d].values)
argVals = [ {‘y’:argList}]
buttons.append(dict(method='update',
label=str(d)[:10],
visible=True,
args=argVals))
buttons2=
for d in df_input.columns:
argList =
argList.append(df_input[d].values)
argVals = [ {‘y’:argList}]
buttons2.append(dict(method='update',
label=str(d)[:10],
visible=True,
args=argVals))
updatemenu=
your_menu=dict()
updatemenu.append(your_menu)
your_menu2=dict()
updatemenu.append(your_menu2)
updatemenu[1]
updatemenu[0][‘buttons’]=buttons
updatemenu[0][‘direction’]=‘down’
updatemenu[0][‘showactive’]=True
updatemenu[1][‘buttons’]=buttons2
updatemenu[1][‘y’]=0.6
fig.update_layout(showlegend=False, updatemenus=updatemenu)
plyo.plot(fig)