Description Usage Arguments Note See Also Examples
Add custom markers at coordinates.
1 2 3 | add_markers(p, lon, lat, ...)
markers_options(p, ...)
|
p |
a datamaps object. |
lon, lat |
coordinates. |
... |
any other parameter. |
Icons may not show in RStudio viewer, open in browser.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | coords <- data.frame(
city = c("London", "New York", "Beijing", "Sydney"),
lon = c(-0.1167218, -73.98002, 116.3883, 151.18518),
lat = c(51.49999, 40.74998, 39.92889, -33.92001),
radius = runif(4, 5, 17)
)
icon_url <- paste0(
"https://pbs.twimg.com/profile_images/",
"927645314630193158/ufoYTbbi_400x400.jpg"
)
coords %>%
datamaps() %>%
markers_options(
icon = list(
url = icon_url,
width = 20, height = 20
),
fillOpacity = 1
) %>%
add_markers(lon, lat)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.