# Commun slider for subplots using choropleth map

**URL:** https://community.plotly.com/t/commun-slider-for-subplots-using-choropleth-map/74096
**Category:** 📊 Plotly Python
**Created:** [April 3, 2023, 7:28pm UTC](https://community.plotly.com/t/commun-slider-for-subplots-using-choropleth-map/74096 "2023-04-03T19:28:01Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![SirJorge](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@SirJorge](https://community.plotly.com/u/SirJorge)
#### Post date: [April 3, 2023, 7:28pm UTC](https://community.plotly.com/t/commun-slider-for-subplots-using-choropleth-map/74096/1 "2023-04-03T19:28:01Z")

</div>

Hello,

I’ve been trying to plot a subplot with a commun slider using plotly.express.choropleth\_mapbox.  
I have 4 dataframes with same variables and I proceed of this way :

```auto
fig1 = px.choropleth_mapbox(df_plot_FR_1, geojson=geo_dep, locations='code_insee', color='Densite',
                      color_continuous_scale=["yellow", "red", "green"],
                      range_color=(min_count, max_count),hover_name = "Departement",
                      featureidkey="properties.code_insee",opacity=0.5,animation_frame='Year')
fig2 = px.choropleth_mapbox(df_plot_FR_2, geojson=geo_dep, locations='code_insee', color='Densite',
                      color_continuous_scale=["yellow", "red", "green"],
                      range_color=(min_count, max_count),hover_name = "Departement",
                      featureidkey="properties.code_insee",opacity=0.5,animation_frame='Year')
fig3 = px.choropleth_mapbox(df_plot_FR_3, geojson=geo_dep, locations='code_insee', color='Densite',
                      color_continuous_scale=["yellow", "red", "green"],
                      range_color=(min_count, max_count),hover_name = "Departement",
                      featureidkey="properties.code_insee",opacity=0.5,animation_frame='Year')
fig4 = px.choropleth_mapbox(df_plot_FR_4, geojson=geo_dep, locations='code_insee', color='Densite',
                      color_continuous_scale=["yellow", "red", "green"],
                      range_color=(min_count, max_count),hover_name = "Departement",
                      featureidkey="properties.code_insee",opacity=0.5,animation_frame='Year')

fig = make_subplots(rows=3, cols=2,
                    subplot_titles=['France metro hors IDF', 'Ile de France', 'Guadaloupe et Martinique', 'Réunion'],
                    specs=[[{"rowspan": 3,'type': 'mapbox'}, {'type': 'mapbox'}],#{"rowspan": 3}
                           [None,{'type': 'mapbox'}],
                           [None,{'type': 'mapbox'}]
                        ],horizontal_spacing = 0.05,vertical_spacing = 0.05)

fig.add_trace(fig1['data'][0], row=1, col=1)
fig.add_trace(fig2['data'][0], row=1, col=2)
fig.add_trace(fig3['data'][0], row=2, col=2)
fig.add_trace(fig4['data'][0], row=3, col=2)

fig.update_mapboxes(style='white-bg')
fig.update_layout(title_text='Evolution de la densité des professionels par departement (2012 - 2022)',
                  margin={'l': 0, 'r': 0, 't': 100, 'b': 0},#,height=600
                  mapbox1=dict(center={'lat': 46.3, 'lon': 1.6751},zoom=4.2,),
                  mapbox2=dict(center={'lat': 48.69, 'lon': 2.58},zoom=5,),
                  mapbox3=dict(center={'lat': 15.53, 'lon': -61.36},zoom=5,),
                  mapbox4=dict(center={'lat': -21.12, 'lon': 55.52},zoom=6,),
                  coloraxis_showscale=True,height=700,
                  )

fig.show()

```

My problem is how to add the slider to visualize the evolution in the variable “Year” ?

I really appreciate any suggestions or solution for this difficulty.  
Thanks in advance
