Change color gradiant of choropleth map

Hello there, everyone.

I’m trying to change de color gradiant in my choropleth map. Well, surely the awnser is out there but I really coudn’t find it anywhere. There’s a print of my map here

I would like for the color gradiant to start at 100, for example.
Also, would there be a way to make the scale between the current min and max values ploted?
Thanks.

As I understand, you can use range_color for this case.
For example:

fig = px.choropleth_mapbox(df,
                                 locations=df["county_fips"],
                                 geojson=counties,
                                 featureidkey="properties.geoid",
                                 color=df['sale_dollars'],
                                 hover_name="county",
                                 range_color=(0, df['sale_dollars'].iloc[0]),
                                 zoom=5,
                                 center={"lat": 42.01604, "lon": -92.91157},
                                 mapbox_style="carto-positron",
                                 color_continuous_scale="Viridis")

So you can change range_color(100,200) or range_color(df['column'].min(),df['column'].max()

1 Like

I was able to solve my issue using color_continuous_scale=[(0, “yellow”), (0.5, “orange”), (1, “red”)] after going through again and again in the documentation. But thanks anyway!