
Add north arrow to frames
add_northarrow.Rd
This function adds a north arrow to frames created with frames_spatial
.
Usage
add_northarrow(
frames,
height = 0.05,
position = "bottomright",
x = NULL,
y = NULL,
colour = "black",
size = 1,
label_text = "N",
label_margin = 0.4,
label_size = 5,
verbose = TRUE
)
Arguments
- frames
an object of class
moveVis
created withframes_spatial
.- height
numeric, height of the north arrow in a range from 0 to 1 as the proportion of the overall height of the frame map.
- position
character, position of the north arrow on the map. Either
"bottomleft", "upperleft", "upperright", "bottomright"
. Ignored, ifx
andy
are set.- x
numeric, position of the bottom left corner of the north arrow on the x axis. If not set,
position
is used to calculate the position of the north arrow.- y
numeric, position of the bottom left corner of the north arrow on the y axis. If not set,
position
is used to calculate the position of the north arrow.- colour
character, colour.
- size
numeric, arrow size.
- label_text
character, text below the north arrow.
- label_margin
numeric, margin between label and north arrow as a proportion of the size of the north arrow.
- label_size
numeric, label font size.
- verbose
logical, if
TRUE
, messages and progress information are displayed on the console (default).
Examples
library(moveVis)
library(move2)
library(terra)
data("move_data", package = "moveVis")
r <- readRDS(example_data(file = "raster_NDVI.rds"))
# align movement
m <- align_move(move_data, res = units::set_units(4, "min"))
#> Temporal resolution of 4 [min] is used to align trajectories.
# create frames and add northarrow
frames <- frames_spatial(m, r, r_type = "gradient", fade_raster = TRUE) %>%
add_northarrow()
#> Processing input data...
#> Approximated animation duration: ≈ 7.52s at 25 fps using 188 frames
#> CRS (geodetic): WGS 84
#> Assigning raster maps to frames...
frames[[100]]
# or in white at another position
frames <- frames_spatial(m, r, r_type = "gradient", fade_raster = TRUE) %>%
add_northarrow(colour = "white", position = "bottomleft")
#> Processing input data...
#> Approximated animation duration: ≈ 7.52s at 25 fps using 188 frames
#> CRS (geodetic): WGS 84
#> Assigning raster maps to frames...
frames[[100]]