Kaggle笔记本电脑需要很长的时间才能加载Choropleth。因此,我尝试使用plotly.io
将图形呈现到新标签页。但是Kaggle笔记本找不到可运行的浏览器。
PS。此代码可在Jupyter Notebook上完美运行。
import plotly.io as pio
pio.renderers.default = 'notebook'
fig = px.choropleth_mapbox(country_df, locations='id', geojson=world_map, color = 'Counts',
hover_name='Country',
mapbox_style='carto-positron',
center={'lat': 30, 'lon': 0},
zoom=1,
opacity=0.7 )
fig.update_geos(fitbounds='locations')
pio.show(fig);