Reputation: 63
I am trying to put a label on tiles based on a “CHANGE” or “COUNTY” item as shown below. I couldnt achieve it. Below is my sample code.
fig = px.choropleth(stat_data, geojson=geo_json_data, color="CHANGE",
locations="COUNTY", featureidkey="properties.COUNTY",
projection="mercator",
color_continuous_scale=px.colors.diverging.RdYlGn, color_continuous_midpoint=2
)
fig.update_geos(fitbounds="locations", visible=False)
fig.show()
I tried with plotlyexpress or go method with the advice shown on answer on other forum looks like it only works for figure factory since scatter method is only available for that one.
Any help will be appreciated.
Upvotes: 2
Views: 897
Reputation: 63
I found an answer on here : https://community.plotly.com/t/annotations-on-plotly-choropleth/36219
fig.add_scattergeo(
geojson=counties,
locations = df['names'],
text = df['values'],
featureidkey="properties.NAME_3",
mode = 'text')
Upvotes: 2