Generates distinct and visually distinct colours for a set of input tags
using the default hue-based palette from ggplot2
(via scales::hue_pal()
).
This is useful for assigning consistent colours to categorical labels in
plots, for example in an animation, where not all individuals always have
data in each frame.
Value
A named character vector of hex color codes if
option = "vector"
, or a data.table
with two columns
(tag
, colour
) if
option = "table"
.
Examples
# Default output (named vector)
atl_tag_cols(c("1234", "2121", "9999"))
#> Error in atl_tag_cols(c("1234", "2121", "9999")): could not find function "atl_tag_cols"
# Output as a data.table
atl_tag_cols(c("1234", "2121", "9999"), option = "table")
#> Error in atl_tag_cols(c("1234", "2121", "9999"), option = "table"): could not find function "atl_tag_cols"