0

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)
  • Hi and welcome on SO. It will be great if you can have a look at [how-to-ask](/help/how-to-ask) and then try to produce a [mcve](/help/mcve). – rpanai Oct 06 '20 at 02:05
  • Does this [answer](https://stackoverflow.com/a/64108889/4819376) help you? – rpanai Oct 06 '20 at 02:08

0 Answers0