How to add static labels to plotly express `choropleth_mapbox`?

With current code I get hover tooltips, however those are not visible on PNG export. I need to have static label on each polygon.

plotly choropleth_mapbox

import as px

df =
geojson =

fig = px.choropleth_mapbox(df, geojson=geojson, color="Bergeron",
                           locations="district", featureidkey="properties.district",
                           center={"lat": 45.5517, "lon": -73.7073},
                           mapbox_style="carto-positron", zoom=9)

Solutions which I found are not working, they work only for choropleth but not for choropleth_mapbox which I want to use. List of them:

Solution on Stack Overflow:

1 Like