
Add labels to frames
add_labels.Rd
This function adds character labels such as titles or axis labels to frames created with frames_spatial
.
Arguments
- frames
an object of class
moveVis
created withframes_spatial
.- title
character, frame title. If
NULL
, an existing title offrames
is removed. Ifwaiver()
(default, seewaiver
), an existing title offrames
is kept.- subtitle
character, frame subtitle. If
NULL
, an existing title offrames
is removed. Ifwaiver()
(default, seewaiver
), an existing title offrames
is kept.- caption
character, frame caption. If
NULL
, an existing title offrames
is removed. Ifwaiver()
(default, seewaiver
), an existing title offrames
is kept.- tag
character, frame tag. If
NULL
, an existing title offrames
is removed. Ifwaiver()
(default, seewaiver
), an existing title offrames
is kept.- x
character, label of the x axis. If
NULL
, an existing title offrames
is removed. Ifwaiver()
(default, seewaiver
), an existing title offrames
is kept.- y
character, label of the y axis. If
NULL
, an existing title offrames
is removed. Ifwaiver()
(default, seewaiver
), an existing title offrames
is kept.- 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 labels
frames <- frames_spatial(
m, r, r_type = "gradient", fade_raster = TRUE
)
#> Processing input data...
#> Approximated animation duration: ≈ 7.52s at 25 fps using 188 frames
#> CRS (geodetic): WGS 84
#> Assigning raster maps to frames...
# add labels
frames <- add_labels(
frames,
title = "Example animation using moveVis::add_labels()",
subtitle = "Adding a subtitle to frames created using frames_spatial()",
caption = "Projection: Geographical, WGS84. Sources: moveVis examples.",
x = "Longitude", y = "Latitude"
)
# have a look at one frame
frames[[100]]