I'm making a map in ggplot, and because I'm using the rnaturalearth package for the world basemap, the tick mark labels have N and W in them.
How do I remove the square box and the N or W symbols in the tick marks? The longitude values should be -0 to -70.
library(tidyverse)
library(rnaturalearth)
world <- ne_countries(scale = "medium", returnclass = "sf")
ggplot() +
# basemap
geom_sf(data = world, colour = NA, fill = "grey75") +
coord_sf(ylim = c(43, 72), xlim = c(-68, -2)) +
labs(x = "", y = "") +
theme_bw()
You could set your desired format for the axes labels via the labels
argument of scale_x/y_continuous
, e.g. to achieve your desired result use labels = ~ .x
:
library(tidyverse)
library(rnaturalearth)
world <- ne_countries(scale = "medium", returnclass = "sf")
ggplot() +
geom_sf(data = world, colour = NA, fill = "grey75") +
coord_sf(ylim = c(43, 72), xlim = c(-68, -2)) +
labs(x = NULL, y = NULL) +
scale_x_continuous(labels = ~ .x) +
scale_y_continuous(labels = ~ .x) +
theme_bw()