Skip to content Skip to sidebar Skip to footer

Python: Can I Make The Colorbar Static In A Plotly Time Series Choropleth?

I am exploring the COVID cases over time in a world map. Right now, the colorscale is dynamic and the min and max change every day. I want to fix them (maybe to 0 and to the alltim

Solution 1:

It seems to be fixed with max=80,zmin=0. I used this information as a reference. How to keep the color bar in a choropleth map consistent with changing data

for datum indf['datum'].unique():
    df_segmented = df_cleaned[df_cleaned['datum']==datum]
    data_each_date = dict(type='choropleth',
                locations = df_segmented['iso_code'],
                z = df_segmented['new_deaths_per_million'],

                zmax = 50, # update
                zmin = 0, # update
                text = df_segmented['location'],
                colorbar = {'title':'New Deaths per Million'})
    data_slider.append(data_each_date)

enter image description here

Post a Comment for "Python: Can I Make The Colorbar Static In A Plotly Time Series Choropleth?"