Learn R Programming

ggsn (version 0.5.0)

north2: North symbol 2

Description

Alternative implementation to add a north symbol to maps created with ggplot or map.

Usage

north2(ggp, x = 0.65, y = 0.9, scale = 0.1, symbol = 1)

Arguments

ggp

ggplot2 object.

x

number between 0 and 1 to indicate the x axis position of the symbol's bottom left corner. 0 is the left side and 1 the right side.

y

number between 0 and 1 to indicate the y axis position of the symbol's bottom left corner. 0 is the bottom and 1 the top.

scale

number between 0 and 1 to indicate the symbol size as a proportion of the plot area (not the map size).

symbol

number between 1 and 18 to choose a symbol (see northSymbols).

Details

North symbols are included in the plot with the annotation_custom function, which do not works when used together with an empty call to ggplot (see last example). When it is convenient to use an empty call to ggplot, use north2 instead.

Examples

Run this code
# NOT RUN {
library(sf)
data(domestic_violence)
map <- ggplot(domestic_violence, aes(fill = Scaled)) +
    geom_sf() +
    scale_fill_continuous(low = "#fff7ec", high = "#7F0000") +
    blank()
north2(map, .5, .5, symbol = 10)
# }

Run the code above in your browser using DataLab