Use this function to join two sequential palettes into a diverging palette.
pth_palette_join(palette_low, palette_high, ...)
# S3 method for default
pth_palette_join(palette_low, palette_high, ...)
# S3 method for pth_palette_hex
pth_palette_join(palette_low, palette_high, ...)
# S3 method for pth_palette_path
pth_palette_join(palette_low, palette_high, ...)
function
with S3 class pth_palette
,
palettes to join. palette_low
will be reversed; both palettes will be
rescaled then joined.
other args (not used)
function
with S3 class pth_palette
,
same as palette_low
, palette_high
.
# both these palettes go from light grey to a darker color
pal_hex_blue <- pth_new_palette_hex(c("#e2e2e2", "#9cbaee", "#3c79c0"))
pal_hex_orange <- pth_new_palette_hex(c("#e2e2e2", "#e0af85", "#a66a00"))
# palette_low (in this case, blue) is reversed,
# putting the light grey in the middle
pal_hex_join <- pth_palette_join(pal_hex_blue, pal_hex_orange)
# recover the original hex codes
pal_hex_join(seq(0, 1, by = 0.25)) %>% pth_to_hex()
#> [1] "#3c79c0" "#9cbaee" "#e2e2e2" "#e0af85" "#a66a00"
#> attr(,"class")
#> [1] "pth_hex"