compare | R Documentation |
This function creates a comparison view between two Mapbox GL or Maplibre GL maps, allowing users to swipe between the two maps to compare different styles or data layers.
compare(
map1,
map2,
width = "100%",
height = NULL,
elementId = NULL,
mousemove = FALSE,
orientation = "vertical"
)
map1 |
A |
map2 |
A |
width |
Width of the map container. |
height |
Height of the map container. |
elementId |
An optional string specifying the ID of the container for the comparison. If NULL, a unique ID will be generated. |
mousemove |
A logical value indicating whether to enable swiping during cursor movement (rather than only when clicked). |
orientation |
A string specifying the orientation of the swiper, either "horizontal" or "vertical". |
A comparison widget.
## Not run:
library(mapgl)
library(mapgl)
m1 <- mapboxgl(style = mapbox_style("light"))
m2 <- mapboxgl(style = mapbox_style("dark"))
compare(m1, m2)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.