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

Choropleth data missing after exporting to html file

Choropleth map State missing when exported to a html file but works fine on jupyter or colab notebook. Please help am I missing something here?

below is the image of plot output on colab notebook :

and this image is when exported as a html file:


as you can see one of the state in the middle is missing on the html file.

code:

fig = px.choropleth_mapbox(
    wiki_df,
    locations="id",
    geojson=india_geojson,
    color="Cases",
    hover_name="States",
    hover_data=["Cases","Recovered","Active", "Deaths", "Date"],
    title="Heat Map of Covid Cases in India",
    mapbox_style="carto-positron",
    color_continuous_scale='Inferno_r',
    center={"lat": 24, "lon": 78},
    zoom=3,
    opacity=1,
)
fig.update_layout(height=580,width=600, plot_bgcolor='rgb(248,249,252)', paper_bgcolor='rgb(248,249,252)',)
fig.show()

Any kind of suggestion or help is appreciated.

Hey @atharvakatre, welcome to the Plotly forums!
Could you provide a link to wiki_df and india_geojson? It would help for debugging :slight_smile:

Edit: I fixed this issue @nickest :slightly_smiling_face:
Turns out that the State which was missing in the html file had id=0 in the geojson file so I changed the State id for that missing State to a non zero value and it worked!
Python was able to access the state with id=0 when I produced the same plot in jupyter notebook but I guess html can’t handle zero value.
I’m still not sure if this is the correct reasoning but it seems relevant in this scenario.