Create vector of color from vector
Usage
colorize(x, colors = c("#440154", "#21908C", "#FDE725"))
Arguments
- x
A numeric, character or factor object.
- colors
A character string of colors (ordered) to colorize
x
Examples
colorize(runif(10))
#> [1] "#440154" "#399980" "#CCD33B" "#6AAD69" "#34406C" "#248085" "#2C6079"
#> [8] "#9BC052" "#FDE725" "#3C2060"
colorize(LETTERS[rbinom(20, 5, 0.5)], c("#FF0000", "#00FFFF"))
#> [1] "#FF0000" "#55AAAA" "#AA5555" "#55AAAA" "#55AAAA" "#FF0000" "#AA5555"
#> [8] "#00FFFF" "#FF0000" "#55AAAA" "#AA5555" "#FF0000" "#55AAAA" "#55AAAA"
#> [15] "#55AAAA" "#FF0000" "#55AAAA" "#FF0000" "#AA5555" "#55AAAA"