The "standard" palette function in this package takes a numeric input
(0 <= x <=1
) and returns a matrix output (LUV coordinates).
Perhaps you want a palette function to return hex-codes; use as_pal_hex()
.
Perhaps you want a palette function to act as a discrete-palette function;
use as_pal_disc()
.
It is important to keep in mind that each of these functions returns a function.
as_pal_hex(pal_luv)
as_pal_disc(pal)
function
with S3 class "cpath_pal_luv"
function
that takes a numeric input and returns a color value.
function
:
as_pal_hex()
return a palette function that returns hex-codes.
as_pal_disc()
return a discrete-palette function which takes
an integer input n
, and returns n
equally-distributed values.
# create LUV palette-function
pal_blues <- pal_luv_bezier(mat_luv_blues)
# create hex palette-function
pal_blues_hex <- as_pal_hex(pal_blues)
# evaluate
pal_blues_hex(seq(0, 1, by = 0.2))
#> [1] "#474747" "#43597B" "#4075B6" "#87B1F3" "#BCCEF1" "#E2E2E2"
# create a discrete hex palette-function
pal_blues_hex_disc <- as_pal_disc(pal_blues_hex)
# evaluate
pal_blues_hex_disc(6)
#> [1] "#474747" "#43597B" "#4075B6" "#87B1F3" "#BCCEF1" "#E2E2E2"