Creates a ggplot of the x-y trajectory from an aniframe. One path is drawn
per trajectory group, where a group is the combination of every
variables_what column and every non-time variables_when column in the
aniframe's metadata.
Usage
plot_trajectory(data, ...)
# Default S3 method
plot_trajectory(data, ..., mode = c("light", "dark"), palette = "Dark 3")Arguments
- data
An aniframe object.
- ...
Additional arguments (currently unused).
- mode
Either
"light"(default) or"dark"; passed totheme_animovement().- palette
Name of a qualitative palette accepted by
grDevices::hcl.colors(); controls the hue family across grouping levels.
Details
Colours adapt to the dataset shape:
single trajectory (no grouping): the line is coloured continuously by
timeusing the Material gradient scale (scale_colour_material_c()), shown as atimecolour bar.what-only or when-only grouping (one varying axis): each line gets its own hue from a qualitative palette, with
timemapped to alpha so the line fades in from start to end — shown in atimelegend.matrix grouping (both axes vary): each line is solid, coloured by the hue × shade matrix from
palette_animovement()— hue perwhat, shade perwhen; time reads from the start/end markers.
Every trajectory is annotated with a filled circle at its first point and a filled triangle at its last point, identified in a start/end legend. Gaps from missing data are bridged with a dashed line so the path stays traceable.