【发布时间】:2019-06-19 16:28:45
【问题描述】:
我需要在中美洲的裁剪世界地图中只为哥斯达黎加上色。
我已经编写的代码包含在下面...我希望能够使用 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)))
【问题讨论】: