rtPalette: Create non-linear palettes

Description Usage Arguments Examples

View source: R/helpers.R

Description

A wrapper around colorRampPalette to create palettes where the number of interpolated colours is not linear, i.e. there may be a different number of colour values between the colors that shall be interpolated.

Usage

1
rtPalette(colors, steps = NULL, ...)

Arguments

colors

[character(.)]
colours to interpolate. must be a valid argument to col2rgb.

steps

[integerish(.)]
the number of colours between each of 'colors'.

...

arguments to pass to colorRampPalette.

Examples

1
2
3
4
5
6
7
myColours <- terrain.colors(5)

linearPalette <- rtPalette(colors = myColours)
pie(x = rep(1, 50), col = linearPalette(50), labels = NA)

nonlinearPalette <- rtPalette(colors = myColours, steps = c(20, 20, 2, 2))
pie(x = rep(1, 50), col = nonlinearPalette(50), labels = NA)

EhrmannS/rasterTools documentation built on Sept. 4, 2019, 10:34 a.m.