I am currently using tmap to create interactive maps. Since the results are quite cluttered at initial zoom (see image below), I would like to implement marker clusters.

I know leaflet allows using marker clusters by adding the parameter clusterOptions = markerClusterOptions() to addMarkers() or addCircleMarkers() calls (Source: https://rstudio.github.io/leaflet/markers.html) but haven't found how to achieve that using tmap.
How can I add marker clusters in tmap?
If anyone from the future is curious, tmap supports clustering by setting clustering = TRUE in tm_symbols.
library(tmap)
data(metro)
tmap_mode("view")
tm_shape(metro) + tm_dots(clustering = T)

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With