plotly / plotly.js

Open-source JavaScript charting library behind Plotly and Dash
https://plotly.com/javascript/
MIT License
16.72k stars 1.83k forks source link

Clustering error using non-mapbox styles #6486

Open TimLC opened 1 year ago

TimLC commented 1 year ago

Hello, I want to use the “cluster” functionality added to version 5.11 of Plotly for Scatter Mapbox but I have a different behavior depending on the mapbox_style used. If I use a mapbox_style of “Mapbox API” I have the number of values contained in each cluster whereas if I use another mapbox_style which does not require “Mapbox API” then the number of values contained in each cluster is not displayed.

Example : df = pd.read_csv(“https://raw.githubusercontent.com/plotly/datasets/master/2011_february_us_airport_traffic.csv”) px.set_mapbox_access_token(‘XXX’) fig = px.scatter_mapbox(df, lat=“lat”, lon=“long”, size=“cnt”, zoom=3, mapbox_style=“basic”) fig.update_traces(cluster=dict(enabled=True)) fig.show() image

df = pd.read_csv(“https://raw.githubusercontent.com/plotly/datasets/master/2011_february_us_airport_traffic.csv”) fig = px.scatter_mapbox(df, lat=“lat”, lon=“long”, size=“cnt”, zoom=3, mapbox_style=“open-street-map”) fig.update_traces(cluster=dict(enabled=True)) fig.show() image

AaronStiff commented 1 year ago

@alexcjohnson I wasn't able to figure out where this is happening, but would it be a plotly.js issue?

alexcjohnson commented 1 year ago

Confirmed, I'll move to plotly.js. If I open the mapbox_scattercluster mock and call: Plotly.relayout(gd,'mapbox.style','open-street-map') the same error happens, with this error message:

Screenshot 2023-02-15 at 15 12 43