palette_okabe_ito() is a wrapper around palette.colors() that returns the Okabe-Ito palette in R 4.0.0 or greater. palette_okabe_ito() returns an unnamed vector of colors for better use with ggplot2. Additionally, black is the last color returned by palette_okabe_ito() when 9 colors are needed instead of the first, as in palette.colors().

palette_okabe_ito(order = 1:9, alpha = NULL, recycle = FALSE)

Arguments

order

A numeric vector, the order of the colors, or a character vector of color names, of: "black", "orange", "skyblue", "bluishgreen", "yellow", "blue", "vermillion", "reddishpurple", "gray". If alpha is not NULL, you must use an integer vector since the colors are not returned with names.

alpha

an alpha-transparency level in the range [0,1] (0 means transparent and 1 means opaque).

recycle

logical indicating what happens in case n > length(palette(.)). By default (recycle = FALSE), the result is as for n = NULL, but with a warning.

Value

A character vector of hex codes

Examples


palette_okabe_ito()
#> [1] "#E69F00" "#56B4E9" "#009E73" "#F0E442" "#0072B2" "#D55E00" "#CC79A7"
#> [8] "#999999" "#000000"

palette_okabe_ito(order = c(2, 3, 5), alpha = 0.9)
#> [1] "#56B4E9E6" "#009E73E6" "#0072B2E6"

palette_okabe_ito(order = c("bluishgreen", "yellow", "blue"))
#> [1] "#009E73" "#F0E442" "#0072B2"