palette_cont: Color palettes (continuous)

Description Usage Arguments Examples

Description

Color palettes (continuous)

Usage

1
2
3
pal_red_cont(isseq = TRUE)

pal_blue_cont(isseq = TRUE)

Arguments

isseq

logical, if TRUE called with a numeric vector with values between 0 and 1 returns the corresponding values in the range the scale maps to, if FALSE called with a integer value controls the number of colours to be returned.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
library(scales)

# get colours by location
pal <- pal_red_cont()
cols <- pal(c(0.1, 0.3, 0.5, 0.7, 0.9))
plot(1, 1, xlim = c(0, 6), ylim = c(0, 6), type = "n", axes = FALSE,
     bty = "n", xlab = "", ylab = "")
rect(xleft = 0:4, ybottom = 3, xright = 1:5, ytop = 4, col = cols,
     border = "light grey")

# get colours by number
pal <- pal_red_cont(isseq = FALSE)
cols <- pal(5)
plot(1, 1, xlim = c(0, 6), ylim = c(0, 6), type = "n", axes = FALSE,
     bty = "n", xlab = "", ylab = "")
rect(xleft = 0:4, ybottom = 3, xright = 1:5, ytop = 4, col = cols,
     border = "light grey")

purplezippo/ggpkt documentation built on May 21, 2019, 10:34 a.m.