Builds a named character vector mapping trajectory group keys to colours.
The colour scheme adapts to how many identity (what) and temporal context
(when, such as session or trial) levels the aniframe's grouping columns
(anicore::get_keys()) have:
Arguments
- data
An aniframe.
- palette
Name of a qualitative palette accepted by
grDevices::hcl.colors(). Default"Dark 3".- single_hue
Colour used when neither
whatnorwhenhas more than one level.
Details
single (one of each, or none): a single hue.
what (multiple
what, onewhen): one qualitative hue perwhatlevel.when (one
what, multiplewhen): one qualitative hue perwhenlevel.matrix (multiple of both): one hue per
whatlevel, then a lighter-to-darker shade of that hue perwhenlevel.
Names of the returned vector match the group keys returned by the internal grouping logic — the redundant axis is dropped when only one side varies.
Examples
af <- anicore::example_anipoint(n_obs = 10, n_individuals = 2, n_keypoints = 1)
palette_animovement(af)
#> 1 | centroid 2 | centroid
#> "#E16A86" "#00AD9A"