Skip to contents

Uses the function grDevices::palette.colors() to generate discrete color palettes using the following rules:

  • n <= 9: "Okabe-Ito".

  • n == 10: "Tableau 10"

  • n > 10 && n <= 12: "Paired"

  • n > 12 && n <= 26: "Alphabet"

  • n > 26 && n <= 36: "Polychrome 36"

Usage

color_discrete(n = NULL, rev = FALSE)

Arguments

n

(required, integer) number of colors to generate. Default = NULL

rev

(optional, logical) If TRUE, the color palette is reversed. Default: FALSE

Value

color vector

Examples


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