Add a legend to the map.
add_legend(p)
p | a datamaps object |
---|
data <- data.frame(name = c("USA", "FRA", "CHN", "RUS", "COG", "DZA"), values = c("N. America", "EU", "Asia", "EU", "Africa", "Africa")) data %>% datamaps() %>% add_choropleth(name, values, colors = c("skyblue", "yellow", "orangered")) %>% add_legend()