I have a choropleth map using plotly.express. My map looks like this at the moment:
The highest value is 730 and the lowest value is -11. So the gap between highest and lowest value is huge making the red color expand so much. My question is how do I make the red color only for negative values? I tried to check the
color_discrete_map
But can't seem to understand how can I implement it in my map. My code currently is like this
colorscale = ["rgb(255, 51, 51)", "rgb(210, 231, 154)", "rgb(94, 179, 39)", "rgb(67, 136, 33)", "rgb(33, 74, 12)"]
fig = px.choropleth(
df,
geojson=counties,
locations="fips",
color="value",
color_continuous_scale=colorscale,
range_color=([min_value, max_value]),
scope="usa",
labels={"label": "Name", "value": "Value (%)", "fips": "Geo Id"},
hover_name="label",
)
My data is from a Dataframe with 3 columns (fips, label, value). I wanted the colors to be red on negative values and a dynamic color of green for non negatives.

