I am using plotly express to create a choropleth chart. I want to have a discrete colour scale using these bins: [−50,0) , [0,50), [50,100), [100,150), [150,200), [200,250), [250,300), [300,350), [350,400), [400,450), and [450,500). Below is a snippet of my dataframe.
Country 1990 2019 Code PGR
0 Afghanistan 12.4 38.0 AFG 206.451613
1 Albania 3.3 2.9 ALB -12.121212
2 Algeria 25.8 43.1 DZA 67.054264
I can get the plot to display but I can't figure out how to get my colour set. My code so far is:
fig = px.choropleth(popCodes,locations= popCodes["Code"],
color = popCodes["PGR"],
range_color = (-50, 500),
hover_name = popCodes["Country"],
color_discrete_sequence=px.colors.sequential.Plasma)
fig.show()