Reputation: 15863
I'd like to set the bounds on a choropleth map in plotly express, e.g. such that this map goes from 0 to 5 instead of 1 to 100. Is this possible?
import pandas as pd
import plotly.express as px
df = pd.DataFrame({"state": ["CA", "OR"], "val": [1, 100]})
fig = px.choropleth(locations=df.state,
locationmode="USA-states",
color=df.val,
scope="usa")
fig.show()
(notebook)
Upvotes: 2
Views: 1889
Reputation: 15863
Use the range_color
arg:
fig = px.choropleth(locations=df.state,
locationmode="USA-states",
color=df.val,
scope="usa",
range_color=(0,5))
fig.show()
Upvotes: 3