I'm trying to get a world map using naturalearth data and ggplot2. However, the graticule and axis tick marks and labels are not showing on the x axis in the world map. AFAIK this problem used to be resolved with coord_sf(expand = FALSE)
(I have old code that uses this), but it no longer seems to be working. I've got a workaround using a different format, but would prefer to be able to do it with sf data.
Any help appreciated!
library(ggplot2) # version 3.3.4
library(rnaturalearth) # version 0.1.0
library(sf) # version 1.0-1
map <- rnaturalearth::ne_countries(scale = 110, returnclass = "sf")
ggplot() +
geom_sf(data = map) +
coord_sf(expand = FALSE)
Shows gridlines when I change the limits of the coordinates
ggplot() +
geom_sf(data = map) +
coord_sf(expand = FALSE,
xlim = c(0,50),
ylim = c(0,50))