Created
December 23, 2020 15:20
-
-
Save liannewriting/0b07254e465b5098eb6932afb481aaa4 to your computer and use it in GitHub Desktop.
Python interactive dashboards plotly Dash example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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