03-31-2023 12:07 AM
I have the following code which should render a choropleth map.
import plotly.express as px
import geopandas as gpd
# Example GeoJSON file with polygon geometries
geojson_file = 'example.geojson'
# Read GeoJSON file into GeoDataFrame
*** = gpd.read_file(geojson_file)
# Create Mapbox GL plot
fig = px.choropleth_mapbox(
***,
geojson=***.geometry,
locations=***.index,
color='property',
center=dict(lat=0, lon=0),
zoom=1,
mapbox_style="carto-positron"
)
fig.update_layout(margin=dict(l=0, r=0, t=0, b=0))
fig.show()
however, when I run the code in jupyter notebook, I get a blank output. Map doesn't render.
04-02-2023 09:00 AM
@Keval Shah :
There could be several reasons why the choropleth map is not rendering in your Jupyter notebook. Here are a few things you could try:
If none of these solutions work, you could try using a different library to render the choropleth map, such as Folium or Bokeh.
Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections.
Click here to register and join today!
Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.