I currently have a ggplot of multiple shapefiles that are cropped to be inside a certain bounding box. I want to draw a complete box around the entire region, but the portions of the plot that crop out a shapefile polygon (Mexico's southern edge & Canada's northern edge) won't include the box.
pl = ggplot() +
geom_sf(data = state_union, aes(fill = data)) +
geom_sf(data = counties_thisState, aes(fill = data), color = "gray") +
geom_sf(data = state_union, fill = NA) +
geom_sf(data = canada, fill = "lightgray") +
geom_sf(data = mexico, fill = "lightgray") +
coord_sf(xlim = c(-126, -66), ylim = c(22, 53), expand = FALSE) +
scale_fill_manual(values = colors,
labels = c("0", "> 0 - 5.9", "6.0 - 20.9",
"21.0 - 50.9", "51.0 - 99.9", "> 100",
"States without reporting")) +
annotation_scale(location = "br", width_hint = 0.2) +
annotation_north_arrow(location = "br", which_north = "true",
pad_x = unit(0.5, "in"), pad_y = unit(0.25, "in"),
style = north_arrow_fancy_orienteering) +
xlab("Longitude") + ylab("Latitude") +
labs(title = "Title",
fill = "Fill") +
theme(panel.background = element_rect(color = "black", fill = NA))
I thought that including the theme after all the geom_sf functions would have the box be drawn completely over the polygons but this isn't the case.