Dropdown menu for Plotly Choropleth Map Plots
问题 I am trying to create choropleth maps. Below is an example that works: df = px.data.gapminder().query("year==2007") fig = go.Figure(data=go.Choropleth( locations=happy['iso'], # Spatial coordinates z = happy['Happiness'].astype(float), # Data to be color-coded colorbar_title = "Happiness Score", )) fig.update_layout( title_text = 'Life Expectancy in 2007' ) fig.show() However, I would like to create a dropdown menu that will change the plotted values between different variables (e.g., Life