Issue with go.Scattermap Not Displaying Properly in Chart Studio

Hi, I’m trying to use go.Scattermap to display a set of location markers for addresses in England and Wales. The map renders correctly in Jupyter Notebook, but after uploading it to Chart Studio, I only see a blank scatter plot with empty axes.

Curiously, when I retrieve the figure from Chart Studio using py.get_figure("https://chart-studio.plotly.com/~alexhewson/1742/"), it displays correctly in Jupyter again. However, when embedding it into an iframe on my website, it reverts to the blank scatter plot.

Expected output

Minimal Example

Here’s a minimal example of the code I’m using:

import chart_studio.plotly as py
import pandas as pd
import plotly.graph_objs as go
import plotly.io as pio

df = pd.DataFrame({"location_name": ["London", "Birmingham", "Manchester", "Cardiff"], "lat": [51.5074, 52.4862, 53.4808, 51.4816], "lon": [-0.1278, -1.8904, -2.2426, -3.1791]})

def generate_traces(df: pd.DataFrame) -> list:
    """Generate traces for the chart."""
    colors = {
        "London": "Blue",
        "Birmingham": "Red",
        "Manchester": "Green",
        "Cardiff": "Yellow",
    }

    traces = [
        go.Scattermap(
            lat = df_location['lat'].tolist(),
            lon = df_location['lon'].tolist(),
            mode = 'markers',
            marker=go.scattermap.Marker(
                size=9,
                color= colors[location],
            ),
            text = df_location['location_name'].tolist(),
            hovertemplate="%{text}",
            name=str(location),
        )
        for location, df_location in df.groupby('location_name')
    ]

    return traces

def create_chart(df: pd.DataFrame) -> go.Figure:

    fig = go.Figure()
    traces = generate_traces(df)
    fig.add_traces(traces)

    fig.update_layout(
        margin=dict(l=0, r=0, t=0, b=0),
        map=dict(
            bearing=0,
            center=dict(
                lat=53.0174642,
                lon=-2.5096761,
            ),
            pitch=10,
            zoom=5.3,
        ),
    )

    return fig

def main() -> go.Figure:
    fig = create_chart(df)
    py.plot(fig, filename="map_test")
    return fig

Versions

plotly β€” 6.0.0
plotlygeo β€” 1.0.0
chart-studio β€” 1.1.0
python β€” 3.13.2

Any insights would be greatly appreciated! Thanks.