In this exercise, we are going to re-use the results from the previous one. If you don’t have them available, fire up the code below.
Look at this code to create compass coordinates (for an arrow):
gesis_cologne_compass_data <-
(gesis_bbox + c(?, ?, ?, ?)) %>%
sf::st_as_sfc() %>%
sf::st_sf()
Admittedly, drawing custom elements is a matter of fiddling around. We want to draw an arrow, and we didn’t have this before. Here’s a way to use our compass data and add it to an existing ggplot. Please feel free to adapt it to your liking.
geom_segment(
data =
gesis_cologne_compass_data %>%
rotate_data() %>%
sf::st_bbox() %>%
{data.frame(xmin = .$xmin, xmax = .$xmax, ymin = .$ymin, ymax = .$ymax)},
aes(x = xmin, y = ymin, xend = xmax, yend = ymax),
size = 1.2,
arrow = arrow(length = unit(0.2, "cm"), type = "closed")
)
geom_segment(). Do your offset values from exercise “2” look nice? Adapt them, if not.
ggsn::blank() function to remove all the clutter. Also, you don’t need the rotate_data() function for the unrotated map, right?