I'm using ggplot2 and the sf and tigris packages to draw some maps (with geom_sf()). I was finding that I couldn't turn off grid lines, despite calling theme(panel.grid = element_blank()) and it seems like it's due to using coord_sf.
Here's a non-map example, that's a simpler way to reproduce my issue
library(ggplot2)
dat <- data.frame(x=rnorm(10),
y=rnorm(10))
# grid lines, as expected
ggplot(dat, aes(x,y)) +
geom_point() +
theme_light()
# no grid lines, as expected
ggplot(dat, aes(x,y)) +
geom_point() +
theme_light() +
theme(panel.grid = element_blank())
# why does this have grid lines?
ggplot(dat, aes(x,y)) +
geom_point() +
coord_sf() +
theme_light() +
theme(panel.grid = element_blank())
I'd like to use coord_sf but also turn off gridlines.



As markus linked, https://github.com/tidyverse/ggplot2/issues/2071, this is a bug, adding datum=NA to coord_sf() fixes: