library(sf)
library(dplyr)
library(ggplot2)
library(rnaturalearth)
library(rnaturalearthdata)
data(world.cities, package = "maps")
world <- ne_countries(scale = "medium", returnclass = "sf")
afr_capitals <- world.cities %>% filter(capital == 1) %>%
st_as_sf(coords = c("long", "lat"), crs = 4326) %>%
st_intersection(., world %>% filter(continent == "Africa"))
p <- world %>% filter(continent == "Africa") %>%
ggplot() + geom_sf(aes(fill = name), lwd = 0.2) +
geom_sf(data = afr_capitals, col = "blue", size = 0.5) +
scale_fill_grey(guide = FALSE) + theme_minimal()
ggsave(here::here("external/slides/figures/africa_capitals.png"),
width = 5, height = 4, dpi = 300, bg = "transparent")