Skip to content

Instantly share code, notes, and snippets.

@liannewriting
Created December 23, 2020 15:20
Show Gist options
  • Save liannewriting/0b07254e465b5098eb6932afb481aaa4 to your computer and use it in GitHub Desktop.
Save liannewriting/0b07254e465b5098eb6932afb481aaa4 to your computer and use it in GitHub Desktop.
Python interactive dashboards plotly Dash example
@app.callback(
Output(component_id='price-graph', component_property='figure'),
Input(component_id='geo-dropdown', component_property='value')
)
def update_graph(selected_geography):
filtered_avocado = avocado[avocado['geography'] == selected_geography]
line_fig = px.line(filtered_avocado,
x='date', y='average_price',
color='type',
title=f'Avocado Prices in {selected_geography}')
return line_fig
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment