Skip to contents

Create a vector of n contiguous colors using the Turbo rainbow colormap.

Usage

turbo(n, start = 0, end = 1, rev = FALSE)

Arguments

n

the number of colors (>= 1) to be in the palette.

start

the (corrected) hue in [0, 1] at which the rainbow begins.

end

the (corrected) hue in [0, 1] at which the rainbow ends.

rev

logical indicating whether the ordering of the colors should be reversed.

Value

A character vector cv containing n hex color codes. This can be used either to create a user-defined color palette for subsequent graphics by passing cv to grDevices::palette(), as a col = specification in graphics functions or in par.

References

Mikhailkov, A. (2019). Google AI Blog: Turbo, An Improved Rainbow Colormap for Visualization. https://ai.googleblog.com/2019/08/turbo-improved-rainbow-colormap-for.html. Accessed August 26, 2020.

See also

Examples

# use like e.g. grDevices::rainbow
pie(rep(1, 12), col = rainbow(12), main = "RGB/HSV")

pie(rep(1, 12), col = turbo(12), main = "turbo")