Add a legend to the map.

add_legend(p)

Arguments

p

a datamaps object

Examples

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()