📣 Announcing Plotly.py 5.13.0 - Grouped Scatter, New Markers and Marker Angles, Sankey Links with Arrows, Map Clustering

Hi. I tried a similar example as the one provided under the cluster section but rendering the map in a dash app (wrapped in dcc.Graph). The clusters render well but the label for the number of data points in the cluster is not showing. Any idea as to why?

# dash version 2.9.3 
# plotly version 5.14.1 
import plotly.express as px
import dash
import pandas as pd
from dash import html, dcc

df = pd.read_csv(data_path)
df['size'] = 10
fig = px.scatter_mapbox(
    data_frame=df[:1000],
    lat="LATITUDE",
    lon="LONGITUDE",
    size="size",
    mapbox_style='carto-positron',
    
)
fig.update_traces(cluster=dict(enabled=True))

# Create Dash app
app = dash.Dash()

# Define the layout of the app
app.layout = html.Div(
    [
        dcc.Graph(id="example-graph", figure=fig)
    ]
)
if __name__ == "__main__":
    app.run_server(debug=True)

1 Like