Add custom markers at coordinates.
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.
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)