Python px.choropleth mapbox change between variables

671 views Asked by At

I am graphing a choropleth map and want to switch between variables to be displayed. So instead of only seeing the color for the variable imio_per_100thousand, I would like to add a dropdown menu to add the mapping for itaxed ... and other variables.

Below you can see my code for the final graph, the input is a geojson displaying the German municipalities.

I have seen this link Dropdown menu for Plotly Choropleth Map Plots which is showing a very related topic, however they use plotly graphs object instead of plotly express choropleth such that I was not able to adapt the idea to my code.

imio100 = px.choropleth_mapbox(df, geojson=landkreiseJson, locations='ID_3', color='imio_per_100thousand',
                           featureidkey="properties.ID_3",
                           animation_frame='year',
                           hover_name='Area',
                           color_continuous_scale="Viridis",
                           range_color=(0, 900),
                           zoom=4.8, center = {"lat": 51.3, "lon": 9.4}, 
                           mapbox_style="carto-positron",
                           title="Number of Millionaires per 100,000 inhabitants",
                           opacity=0.5)
0

There are 0 answers