ScatterPlot map (color code)

hi,

Looking for a ScatterPlot -Bubble- map example please. I need to colour code the points using a column in the data set [log, lat, amount, product-type ], and aggregate coordinates [SUM(amount) ] in larger bubble size.

Many thanks

Hey Zanco! Welcome to our forum :smiling_face:

So, st.map is very limited (intentionally) and will not be able to get you to the chart you are trying to achieve. But you can use other charting commands!

For map + scatter chart capabilities, I’ve used Plotly Express scatter_geo command a while ago! It won’t automatically cluster points, but it is still a reasonable solution. See documentation and some straightforward examples.

Mock code:

fig = px.scatter_geo(
    data_frame=df,
    color="color_column",
    lon="lon",
    lat="lat",
    projection="natural earth",
    hover_name="hover_column",
    size="size_column",  # <-- Set the column name for size
    height=800,
)

st.plotly_chart(fig, use_container_width=True)
1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.