create_nested_colours: create_nested_colours

View source: R/create_nested_colours.R

create_nested_coloursR Documentation

create_nested_colours

Description

Based on a dataframe with two grouping columns, return a named vector of colours for interactions of these groups. The hues are spaced based on the primary_group, using scales::hue_pal(), and vary in saturation based on the secondary_group, using colortools::sequential()

Usage

create_nested_colours(df, primary_group, secondary_group, primary_cols = NULL)

Arguments

df

data.frame

primary_group

name of column containting the primary group (character)

secondary_group

name of column containing the secondary group (character)

primary_cols

optional set the hues of the colours manually. must be as many hues as there are primary groups (character vector)

Author(s)

W. S. Drysdake


willdrysdale/wsdmiscr documentation built on Aug. 26, 2023, 12:31 a.m.