get_pal: Create the _pal function for ramped colors

Description Usage Arguments Value Examples

View source: R/scales.R

Description

This wil create a function, that makes the palette with ramped colours.

Usage

1
get_pal(hex_object)

Arguments

hex_object

Either a character vector with hex code, or a list that contains the character vectors with hex codes. List elements should be named.

Value

A function that will create the ramped colors from the color vector, or of one of the vectors in the list. The function has the following parameters:

'palette', a character that indicates which of the color vectors to use.

'alpha', the desired transparancy.

'reverse', if TRUE, the direction of the colours is reversed.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
# devtools::install_github("RopenScilabs/ochRe")
# devtools::install_github("EdwinTh/dutchmasters")

# use get_pal on a single character vector
my_pal <- get_pal(c("#701B06", "#78A8D1", "#E3C78F"))
filled.contour(volcano,
               color.palette = my_pal(),
               asp=1)

# or on a list with multiple vectors
ochRe_pal <- get_pal(ochRe::ochre_palettes)
dutchmasters_pal <- get_pal(dutchmasters::dutchmasters)

filled.contour(volcano,
               color.palette = ochRe_pal(),
               asp=1)

filled.contour(volcano,
               color.palette = dutchmasters_pal("anatomy", reverse = TRUE),
               asp=1)

EdwinTh/paletti documentation built on May 13, 2019, 10:59 p.m.