Generate a vector of hex colour codes for the desired number of colours.
Colours are generated by evenly splitting hue in the range [0,360]
in the HCL colour space using grDevices::hcl.
The output is meant to follow the default colours used in ggplot2::ggplot2.
Arguments
- n
<int> Number of colours to output.
- show
<lgl> TRUE to show the output colours.
Value
A vector of hex colour codes that can be used for plotting.
Examples
hexn(6,FALSE)
#> [1] "#F8766D" "#B79F00" "#00BA38" "#00BFC4" "#619CFF" "#F564E3"
hexn(4,TRUE)
#> [1] "#F8766D" "#7CAE00" "#00BFC4" "#C77CFF"