Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scattermapbox cluster do not work #2327

Open
ctrl-shift-vs opened this issue Jan 3, 2024 · 0 comments
Open

Scattermapbox cluster do not work #2327

ctrl-shift-vs opened this issue Jan 3, 2024 · 0 comments

Comments

@ctrl-shift-vs
Copy link

Clustering of scatter points on a map do not form even though the documentation indicates this should work:
https://plotly.com/r/reference/scattermapbox/#scattermapbox-cluster

It seems to work in Plotly for Python:
https://plotly.com/python/scattermapbox/

Below is a reproducible example. Please use your own mapbox token.

Sys.setenv("MAPBOX_TOKEN" = mapboxtoken)
df = read.csv('https://raw.githubusercontent.com/bcdunbar/datasets/master/meteorites_subset.csv')
fig <- df %>% plot_mapbox(lat = ~reclat, lon = ~reclong,
                          size=2, type = 'scattermapbox',
                          mode = 'scattermapbox', hoverinfo='name',
                          cluster = list(enabled = TRUE, step = -2, color = 'red')) 
fig <- fig %>% layout(title = 'Meteorites',
                      font = list(color='white'),
                      plot_bgcolor = '#191A1A', paper_bgcolor = '#191A1A',
                      mapbox = list(style = 'dark'),
                      legend = list(orientation = 'h',
                                    font = list(size = 8)),
                      margin = list(l = 25, r = 25,
                                    b = 25, t = 25,
                                    pad = 2)) 
fig <- fig %>% config(mapboxAccessToken = Sys.getenv("MAPBOX_TOKEN"))
fig

Warning message:
'scattermapbox' objects don't have these attributes: 'cluster'

No cluster

Cluster formation using Plotly for Python
Screenshot 2024-01-03 at 12 55 53 pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant