Hello Rstudio community -
Can anyone explain the variation in the outline for the great lakes region. By that I mean, what are the tiny areas that pop up as white in the plot, essentially non-overlapping regions between state and lake boundaries. My expectation would be that the lakes region would fill around the state borders. Any suggestions how to rectify this or is this as good as it gets? Below I provide a reproducible plot example for my question.
Code for the plot -
library(rnaturalearth) library(sf) library(dplyr) library(ggplot2) library(magrittr) usa <- rnaturalearth::ne_states(country = "united states of america", returnclass = "sf")%>% dplyr::select(name)%>% filter(name != 'Alaska' & name != 'Hawaii') #download the lake data lakes <- rnaturalearth::ne_download(type = 'lakes', category = 'physical', returnclass = 'sf')%>% dplyr::select(name) #subset for only great lakes greatLakes <- lakes %>% filter(name == 'Lake Huron' | name == 'Lake Ontario' | name == 'Lake Michigan' | name == 'Lake Erie' | name == 'Lake Superior') dummyValue <- rep(1, 49) usa <- cbind(usa, dummyValue) ggplot()+ geom_sf(data = usa, aes(fill = dummyValue))+ geom_sf(data = greatLakes,fill = 'lightblue')+ coord_sf(xlim = c(-100, -70), ylim = c(35, 50))