marimo icon indicating copy to clipboard operation
marimo copied to clipboard

px.scatter_map does not display

Open akshayka opened this issue 1 year ago • 1 comments

Describe the bug

From Discord.

"I am attempting to use a Plotly Scatter Map. When I render it, it shows a basic blank chart. I tried to follow the official Plotly tutorial and it does the same thing. I'll put a screenshot below shortly.

This is the code from the "Basic example with Plotly Express" https://plotly.com/python/tile-scatter-maps/"

image

Environment

HEAD

Code to reproduce

import pandas as pd
import plotly.express as px
df = px.data.carshare()
fig = px.scatter_map(df, lat="centroid_lat", lon="centroid_lon",     color="peak_hour", size="car_hours",
                  color_continuous_scale=px.colors.cyclical.IceFire, size_max=15, zoom=10)
fig

akshayka avatar Sep 17 '24 19:09 akshayka

For reference, this code does work. I am not sure if marimo needs to provide a default map renderer.

import plotly.express as px

df = px.data.carshare()
+ fig = px.scatter_mapbox(
- fig = px.scatter_map(
    df,
    lat="centroid_lat",
    lon="centroid_lon",
    color="peak_hour",
    size="car_hours",
    color_continuous_scale=px.colors.cyclical.IceFire,
    size_max=15,
    zoom=10,
+    mapbox_style="carto-positron",
)
fig

mscolnick avatar Sep 18 '24 12:09 mscolnick

hey, this is actually due to plotly migrating from mapbox to maplibre. https://plotly.com/javascript/maplibre-migration/

I’ve verified that upgrading plotly.js to the latest version (2.34.0 --> 2.35.2) resolves this issue. Would you like me to open a PR for this?

Light2Dark avatar Nov 20 '24 14:11 Light2Dark

hey @Light2Dark, thank would be awesome / very much appreciated, thank you!

mscolnick avatar Nov 20 '24 14:11 mscolnick