How to keep the color bar in a choropleth map consistent with changing data

The scale of the color bar keeps changing in my choropleth map. I don’t know how to keep it consistent, which is essential for what I’m trying to accomplish.

This is my code for the layout:

### create the dictionary with the data for the current year
data_one_year = dict(
locations = countrylist,
autocolorscale = False,
locationmode=‘country names’,
colorscale = scl,
colorbar = dict(
title = “Temperature”,
tickvals = [0,5,10,15,20],
lenmode = ‘pixels’,
`data_slider.append(data_one_year) # I add the dictionary to the list of dictionaries for the slider

As you can see, the values on the bar to the right of the map are changing from place. How do I prevent this and make them stay in the same place?

@yassin, you can do this with the zmax and zmin parameters. Plotly determines zmax and zmin based on the data provided but you can override this behaviour setting them yourself.

This actually solved the problem, thanks :slight_smile: