Scatter mapbox, number of values in the cluster not displayed

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()

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()

Can you help me to resolve this problem?

Hi!
Is it possible that the size of data clusters varies as a function of the number of data points within them?

1 Like