markers-plugin: Add markers

Description Usage Arguments Note See Also Examples

Description

Add custom markers at coordinates.

Usage

1
2
3
add_markers(p, lon, lat, ...)

markers_options(p, ...)

Arguments

p

a datamaps object.

lon, lat

coordinates.

...

any other parameter.

Note

Icons may not show in RStudio viewer, open in browser.

See Also

Plugin documentation

Examples

 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)
  

JohnCoene/datamaps documentation built on May 17, 2018, 12:17 p.m.