I'm trying to build an interactive, simple choropleth heatmap of all the countries in Asia. The plot displays well when in my Jupyter Notebook, but when I try to export it to html, it shows only blank.
The GeoJSON file that I'm using is this one, it's the first result when I google "asia geojson"
A preview of my DataFrame file can be seen here.
My code:
import pandas
import plotly.express as px
import plotly.graph_objects as go
import plotly.io as pio
import plotly
fig = px.choropleth(df, geojson=asia, locations='country', color='population', color_continuous_scale="reds", scope = 'asia', featureidkey="properties.admin", labels={'population':'Population Count'}, center={"lat": 30, "lon": 100})
fig.show()
plotly.offline.plot(fig, filename='myplot.html')
[Screenshot] How it looks on my Jupyter Notebook
[Screenshot] How it looks on my web browser
As we can see, the .html file shows nothing when opened in my web browser. I've read the documentations and the majority of users having similar problems, yet I can't seem to make mine work.
I tried to plot the sample dataset of USA Census Data from their official guide and it exports normally into .html, as expected.
How can I fix this? Any help would be appreciated :)
question from:
https://stackoverflow.com/questions/65926926/plotly-blank-choropleth-map-after-exporting-to-html 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…