Learn R Programming

seriation (version 1.5.6)

palette: Different Useful Color Palettes

Description

Defines several color palettes for pimage(), dissplot() and hmap().

Usage

bluered(n = 100, bias = 1, power = 1, ...)

greenred(n = 100, bias = 1, power = 1, ...)

reds(n = 100, bias = 1, power = 1, ...)

blues(n = 100, bias = 1, power = 1, ...)

greens(n = 100, bias = 1, power = 1, ...)

greys(n = 100, bias = 1, power = 1, ...)

grays(n = 100, bias = 1, power = 1, ...)

Value

A vector with n colors.

Arguments

n

number of different colors produces.

bias

a positive number. Higher values give more widely spaced colors at the high end.

power

used to control how chroma and luminance is increased (1 = linear, 2 = quadratic, etc.)

...

further parameters are passed on to colorspace::sequential_hcl() or colorspace::diverging_hcl().

Author

Michael Hahsler

Details

The color palettes are created with colorspace::sequential_hcl() and colorspace::diverging_hcl().

The two sequential palettes are: reds() and grays() (or greys()).

The two diverging palettes are: bluered() and greenred().

See Also

Other plots: VAT(), bertinplot(), dissplot(), hmap(), pimage()

Examples

Run this code
m <- outer(1:10,1:10)
m

pimage(m)
pimage(m, col = greys(100, power = 2))
pimage(m, col = greys(100, bias = 2))
pimage(m, col = bluered(100))
pimage(m, col = bluered(100, power = .5))
pimage(m, col = bluered(100, bias = 2))
pimage(m - 25, col = greenred(20, bias = 2))

## choose your own color palettes
library(colorspace)
hcl_palettes(plot = TRUE)

## blues (with 20 shades)
pimage(m,
  col = colorspace::sequential_hcl(20, "Blues", rev = TRUE))
## blue to green (aka "Cork")
pimage(m,
  col = colorspace::diverging_hcl(100, "Cork"))

Run the code above in your browser using DataLab