turbo: Turbo Color Palette

View source: R/turbo.R

turboR Documentation

Turbo Color Palette

Description

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 palette(cv), 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

This function originated as (Apache 2 licensed) code at https://gist.github.com/jlmelville/be981e2f36485d8ef9616aef60fd52ab, in turn based on Python code at https://gist.github.com/mikhailov-work/ee72ba4191942acecc03fe6da94fc73f.

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

jlmelville/vizier documentation built on Jan. 17, 2024, 8:13 p.m.