Black Lives Matter. Please consider donating to Black Girls Code today.

Labels inside Counties for a map - Plotly express or Go


ı 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.

I tried with plotlyexpress or go method with the advice shown on:[Labels inside Counties for a map] - looks like it only works for figure factory since scatter method is only avaialble for that one.

Any help wil lbe appreicatd.

fig = px.choropleth(stat_data, geojson=geo_json_data, color="CHANGE",
                    locations="COUNTY", featureidkey="properties.COUNTY",
                    color_continuous_scale=px.colors.diverging.RdYlGn, color_continuous_midpoint=2

fig.update_geos(fitbounds="locations", visible=False)


Hi @zakzakzak,

This has already been discussed here:


1 Like

thank you very much. this is exactly what i was looking for. Thank you very much.

I suggest you to put this part of the information on how to make choropleth chart section as a tutorial everyone can benefit from it.

Thanks again.