Learn R Programming

moveVis (version 0.10.5)

add_timestamps: Add timestamps to frames

Description

This function adds timestamps to animation frames created with frames_spatial.

Usage

add_timestamps(frames, m = NULL, x = NULL, y = NULL, ..., verbose = TRUE)

Arguments

frames

list of ggplot2 objects, crated with frames_spatial.

m

move or moveStack, optional. If defined, timestamps are extracted from m that must be the same object used to create frames with frames_spatial. If undefined (recommended), timestamps are extracted from the attributes of frames directly.

x

numeric, optional, position of timestamps on the x scale. By default, timestamps will be displayed in the top center.

y

numeric, optional, position of timestamps on the y scale.

...

optional, arguments passed to add_text, such as colour, size, type.

verbose

logical, if TRUE, messages and progress information are displayed on the console (default).

Value

List of frames.

See Also

frames_spatial frames_graph animate_frames

Examples

Run this code
# NOT RUN {
library(moveVis)
library(move)

data("move_data", "basemap_data")
m <- align_move(move_data, res = 4, unit = "mins")

# create spatial frames using a custom NDVI base layer
r_list <- basemap_data[[1]]
r_times <- basemap_data[[2]]

# }
# NOT RUN {
frames <- frames_spatial(m, r_list = r_list, r_times = r_times, r_type = "gradient",
                         fade_raster = TRUE)

# add timestamps as text
frames.a <- add_timestamps(frames, type = "text")
frames.a[[100]]

# or use the ggplot2 "label" type:
frames.b <- add_timestamps(frames, type = "label")
frames.b[[100]]
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab