Linked Questions

Popular Questions

I have the following code which should render a choropleth map.

import plotly.express as px
import geopandas as gpd
import plotly
import plotly.express as px
px.set_mapbox_access_token(mapbox_token)
import plotly.graph_objects as go 
import plotly.io as pio
pio.renderers.default = 'notebook'
import shapely
import mapboxgl
from mapboxgl.viz import *
from mapboxgl.utils import *
import matplotlib.pyplot as plt
from IPython.display import display, HTML
display(HTML("<script src='https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/leaflet.js'></script>"))

 
gdf = gpd.GeoDataFrame(df, geometry='geom')
 
# Create Mapbox GL plot
fig = px.choropleth_mapbox(
                           gdf, 
                           geojson=gdf.geometry, 
                           locations=gdf.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 notebook running on Databricks cluster, I get a blank output. Map doesn't render.

mapbox

Are there any configurations / libraries I am missing in my environment?

Related Questions