我想添加一个下拉菜单以仅显示一个数字。我的意思是,如果我选择无花果,破折号必须只显示无花果,如果我选择无花果 2,破折号必须显示无花果 2。这可能吗?我的代码是一个例子,我有 500 多个无花果。
import dash
import dash_core_components as dcc
import dash_html_components as html
import plotly.graph_objects as go # or plotly.express as px
fig = go.Figure()
fig2 = go.Figure()
fig.add_trace(go.Scatter(y=[4, 2, 1], mode="lines"))
fig2.add_trace(go.Bar(y=[2, 1, 3]))
figs = [fig, fig2]
div = []
for item in figs:
div.append(dcc.Graph(figure=item))
app = dash.Dash()
app.layout = html.Div(div)
"""
add a dropdown to show only one fig
"""
app.run_server(debug=True, use_reloader=False)
达令说
FFIVE
相关分类