Add bubbles to the map.

add_bubbles(
  p,
  lon,
  lat,
  radius,
  color,
  name,
  ...,
  colors = c("#FFEDA0", "#FEB24C", "#F03B20")
)

Arguments

p

a datamaps object.

lon, lat

coordinates of bubbles.

radius

radius of bubbles.

color

color of bubbles.

name

name of bubbles.

...

any other variable to use in tooltip.

colors

color palette.

Examples

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), values = runif(4, 5, 17)) coords %>% datamaps() %>% add_bubbles(lon, lat, values * 2, values, city) data <- data.frame(name = c("USA", "FRA", "CHN", "RUS", "COG", "DZA"), color = round(runif(6, 1, 10))) data %>% datamaps(default = "lightgray") %>% add_choropleth(name, color) %>% add_data(coords) %>% add_bubbles(lon, lat, values * 2, values, city, colors = c("red", "blue"))