turbo | R Documentation |
Create a vector of n contiguous colors using the Turbo rainbow colormap.
turbo(n, start = 0, end = 1, rev = FALSE)
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. |
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
.
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.
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.
# 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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.