我是使用 R 制作地图的新手。我正在尝试制作北美地图(以美国为中心),并希望五大湖的颜色与海洋颜色相同。我当前的代码默认使它们与国家/州具有相同的颜色。关于如何改变颜色的任何想法?也许是不同的底图?
当前代码:
library(cowplot)
library(googleway)
library(ggplot2)
library(ggrepel)
library(ggspatial)
library(sf)
library(rnaturalearth)
library(rnaturalearthdata)
world <- ne_countries(scale = "medium", returnclass = "sf")
usa <- st_as_sf(maps::map("state", fill=TRUE, plot =FALSE),
crs = 4269)
ggplot(data = world) +
geom_sf(color = "black", fill = "gray") +
geom_sf(data = usa, color = "black", fill = "gray") +
xlab("Longitude") + ylab("Latitude") +
coord_sf(xlim = c(-123, -69), ylim = c(25, 49), expand = TRUE) +
annotation_scale(location = "br", width_hint = 0.5, text_cex = 1) +
annotation_north_arrow(location = "br", which_north = "true",
pad_x = unit(0.15, "in"), pad_y = unit(0.3, "in"),
style = north_arrow_fancy_orienteering) +
theme_bw() +
theme(plot.title = element_text(hjust = 0.5),
plot.subtitle = element_text(hjust = 0.5),
text = element_text(size = 16),
axis.text.x = element_text(size = 14, color = "black"),
axis.text.y = element_text(size = 14, color = "black"),
panel.grid.major = element_line(color = gray(0.5), linetype = "dashed", size = 0.5),
panel.background = element_rect(fill = "aliceblue"))