Unique extension for Mapbox plots in JupyterLab?

Is there a unique JupyterLab extension for Mapbox plots or does the plotly graph extension cover these graphs? I’ve tried to make a map with the code below, adding the access token afterwards, but the graph output is the JSON format like:

FigureWidget({
    'data': [{'hoverinfo': 'text',
              'lat': [39.29167, 39.29015, 39.29088, 39.29086…

and not the actual map.

Is there a better way to incorporate the mapbox token besides adding is later as fig.layout.mapbox.accesstoken = mapbox_access_token ?

# create list of lat and lon points to graph
lat = df.LAT.unique().tolist()
lon = df.LON.unique().tolist()
# create text to show up on map
name = df.ACCOUNT.unique().tolist()

fig = go.FigureWidget(
    data = [
        dict(
            type = 'scattermapbox',
            lat=lat,
            lon=lon,
            mode='markers',
            text=name,
            hoverinfo='text'
        )
    ],
    
)

fig.layout.mapbox.accesstoken = mapbox_access_token

Hi @melmel,

No, there’s nothing unique about MapBox plots other than the need to provide the access token.

Do other plot types show up when you display them as a FigureWidget? Do you have all of the Python and JupyterLab packages installed as described in the installation instructions (https://github.com/plotly/plotly.py#installation)?

If so, could you include the output of the following commands:

  • $ jupyter labextension list
  • $ pip list
  • $ conda list (If you use conda)

-Jon

Ah! thanks @jmmease–I hadn’t installed everything for plotly JupyterLab support. Everything works!

1 Like