non-overlapping borders for states and lakes region using ggplot2 and rnaturalearth

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.

Thank you :slight_smile:

Code for the plot -


usa <- rnaturalearth::ne_states(country = "united states of america",
                               returnclass = "sf")%>%
  filter(name != 'Alaska' & 
           name != 'Hawaii')

#download the lake data
lakes <- rnaturalearth::ne_download(type = 'lakes', category = 'physical',
                                    returnclass = 'sf')%>%

#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)

  geom_sf(data = usa, aes(fill = dummyValue))+
  geom_sf(data = greatLakes,fill = 'lightblue')+
  coord_sf(xlim = c(-100, -70), ylim = c(35, 50))

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.