pth_palette_join: Join palette functions

View source: R/palette-join.R

pth_palette_joinR Documentation

Join palette functions

Description

Use this function to join two sequential palettes into a diverging palette.

Usage

pth_palette_join(palette_low, palette_high, ...)

## Default S3 method:
pth_palette_join(palette_low, palette_high, ...)

## S3 method for class 'pth_palette_hex'
pth_palette_join(palette_low, palette_high, ...)

## S3 method for class 'pth_palette_path'
pth_palette_join(palette_low, palette_high, ...)

Arguments

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)

Value

function with S3 class pth_palette, same as palette_low, palette_high.

Examples

 # 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()


ijlyttle/colorpath documentation built on Sept. 13, 2022, 7:44 p.m.