我需要在一个裁剪过的中美洲世界地图中只标注哥斯达黎加。
我已经编写的代码如下... 我想使用ggplot2和sf库来完成这个任务。
library("ggplot2")
theme_set(theme_bw())
library("sf")
library("rnaturalearth")
library("rnaturalearthdata")
library("maps")
world <- ne_countries(scale='medium',returnclass = 'sf')
class(world)
(CentralAmerica <- ggplot(data = world) +
geom_sf() +
coord_sf(xlim = c(-60, -120), ylim = c(5, 35), expand = FALSE) +
scale_fill_viridis_d(option = "plasma") +
theme(panel.background = element_rect(fill = "azure"),
panel.border = element_rect(fill = NA)))