Learn R Programming

ggspatial (version 1.0.2)

annotation_north_arrow: Spatial-aware north arrow

Description

Spatial-aware north arrow

Usage

annotation_north_arrow(height = unit(1.5, "cm"), width = unit(1.5, "cm"),
  pad_x = unit(0.25, "cm"), pad_y = unit(0.25, "cm"),
  which_north = c("grid", "true"), rotation = NULL, location = c("tr",
  "bl", "br", "tl"), style = north_arrow_orienteering)

GeomNorthArrow

Arguments

height, width

Height and width of north arrow

pad_x, pad_y

Padding between north arrow and edge of frame

which_north

"grid" results in a north arrow always pointing up; "true" always points to the north pole from whichever corner of the map the north arrow is in.

rotation

Override the rotation of the north arrow (degrees conterclockwise)

location

Where to put the north arrow ("tl" for top left, etc.)

style

A grob or callable that produces a grob that will be drawn as the north arrow. See north_arrow_orienteering for options.

Value

A ggplot2 layer

Format

An object of class GeomNorthArrow (inherits from Geom, ggproto, gg) of length 4.

Examples

Run this code
# NOT RUN {
cities <- data.frame(
  x = c(-63.58595, 116.41214),
  y = c(44.64862, 40.19063),
  city = c("Halifax", "Beijing")
)

ggplot(cities) +
  geom_spatial_point(aes(x, y), crs = 4326) +
  annotation_north_arrow(which_north = "true") +
  coord_sf(crs = 3995)

ggplot(cities) +
  geom_spatial_point(aes(x, y), crs = 4326) +
  annotation_north_arrow(which_north = "grid") +
  coord_sf(crs = 3995)

# }

Run the code above in your browser using DataLab