I am trying to plot parts of three countries using ggplot2 and rnaturalearth, but for some reason it is only possible two plot two at a time and sometimes ony one. I have no idea why that is happening. The code below only plots Denmark, if I change the line target <- c("Netherlands", "Germany", "Denmark")
to target <- c("Germany", "Netherlands", "Denmark")
it plots Denmark and the Netherlands, but not Germany. target <- c("Germany", "Denmark")
gives me Germany and Denmark as desired. But as soon as I add Netherlands only Germany will be plotted. I am really confused here.
library(rnaturalearth)
library(dplyr)
target <- c("Netherlands", "Germany", "Denmark")
ne_countries(scale = 10, returnclass = 'sf') %>%
filter(name == target) %>%
ggplot() +
geom_sf(fill = "#e0e8a0") +
xlim(5,9) +
ylim(53,56) +
theme(panel.background = element_rect(fill = "#8088d0"),
panel.grid = element_line(size = 0.1))