syncWith {leaflet.minicharts} | R Documentation |
Synchronize multiple maps
Description
This function can be used when multiple leaflet maps are displayed on the same view (for instance in a shiny application or a Rmarkdown document) and one wants to synchronize their center, zoom and time.
syncWith()
can also be used with basic leaflet maps to synchronize
only their zoom and center.
Usage
syncWith(map, groupname)
Arguments
map |
A leaflet map object created with |
groupname |
Character string. All maps that use the same group name will be synchronized. |
Value
The modified leaflet map object.
Examples
if (require(manipulateWidget) & require(leaflet)) {
# Synchronize zoom and center of basic maps.
basicMap1 <- leaflet() %>% addTiles() %>% syncWith("basicmaps")
basicMap2 <- leaflet() %>% addTiles() %>% syncWith("basicmaps")
combineWidgets(basicMap1, basicMap2)
# Synchronize time step of two maps that represent the evolution of some
# variable.
map1 <- leaflet() %>% addTiles() %>%
addMinicharts(0, 40, chartdata = 1:10, time = 1:10) %>%
syncWith("maps")
map2 <- leaflet() %>% addTiles() %>%
addMinicharts(0, 40, chartdata = 10:1, time = 1:10) %>%
syncWith("maps")
combineWidgets(map1, map2)
}
[Package leaflet.minicharts version 0.6.2 Index]