I am new to using R to make maps. I am trying to make a map of North America (centered on the US) and would like the Great Lakes to be the same color as the ocean color. My current code defaults to having them the same color as the countries/states. Any ideas on how to change their color? Maybe a different base map?
Current code:
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"))
Ok, I did some diggig, turns out that rnaturalearth have the geometries of the lakes of the whole world.
ne_download(type = 'lakes')
.World as sf
North America as sf
Lakes as sf
US-States as sf
Or alternatively, USA states as sf (so you would´t need
{maps}
)Plot with ggplot2
Change the color of the ocean and the lakes for whatever you want.