I am trying to plot a dictionary with one plot, but multiple dropdown options. Here is a sample of one of the four keys in the dictionary.
time 2m_temp_prod
0 2020-08-14 00:00:00 299.346777
1 2020-08-14 06:00:00 294.039512
2 2020-08-14 12:00:00 292.959274
3 2020-08-14 18:00:00 301.318046
4 2020-08-15 00:00:00 300.623567
Now, I try and plot this dictionary with 4 different options for the dropdowns.
for i in df_vals.keys():
hi=go.Scatter(x=df_vals[i]['time'], y=((df_vals[i]['2m_temp_prod']-273)*(9/5)+32),mode='lines', line=dict(color='red', width=4), hovertemplate='Date: %{x|%d %b %H%M} UTC<br>Temp: %{y:.2f} F<extra></extra>')
updatemenus=[dict(
buttons=list([
dict(
method='update',
label=i,
args= [{'y': [df_vals[i]['2m_temp_prod']]}],
),
]),
direction="down",
pad={"r": 10, "t": 10},
showactive=True,
x=0.07,
xanchor="left",
y=1.15,
yanchor="top"
)]
layout = go.Layout(title='Sfc Temp and 24hr Forecast Change for ',updatemenus=updatemenus, yaxis2=dict(overlaying='y', side='right'), annotations=[dict(text='Ag belt:', x=0, xref='paper', y=1.10, yref='paper', align='left', showarrow=False)])
fig=go.Figure(hi, layout=layout)
fig.show()
However, this plots all 4 plots separately, each one having only one dropdown option. How do I set this up to only make one plot and 4 dropdown options?
Here is a picture for reference.