I have the following data frame:
pacman::p_load(maptools, ggplot2, raster, ggmap)
df <- tribble( ~ country, ~ maternity_leave,
"Argentina", 390,
"Bahamas", 390,
"Barbados", 360,
"Belize", 420,
"Bolivia", 390,
"Brazil", 510,
"Chile", 540,
"Colombia", 540,
"Costa Rica", 510,
"Dominican Republic", 420,
"Ecuador", 360,
"El Salvador", 480,
"Guatemala", 360,
"Guyana", 390,
"Haiti", 360,
"Honduras", 240,
"Jamaica", 240,
"Mexico", 360,
"Nicaragua", 360,
"Panama", 420,
"Paraguay", 540,
"Peru", 420,
"Suriname", 480,
"Trinidad and Tobago", 420,
"Venezuela", 780)
countries <- maternity_leave %>%
pull(country)
map <- borders("world", regions = countries, fill = "grey70", colour = "black")
ggplot() +
map +
xlab("Longitude (decimals)") +
ylab("Latitude (decimals)") +
theme(panel.border = element_blank(),
panel.grid.major = element_line(colour = "grey80"),
panel.grid.minor = element_blank())
But I want to use the variable maternity_leave as a base for color gradient and I do not know how. I tried by changing the map function and scale_colour_gradient2 and sacale_fill_gradient2 with no success.
I would appreciate any help!
