palette function

Different Useful Color Palettes

Different Useful Color Palettes

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

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, ...)

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

Returns

A vector with n colors.

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

Examples

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"))

See Also

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

Author(s)

Michael Hahsler

  • Maintainer: Michael Hahsler
  • License: GPL-3
  • Last published: 2024-12-05