Generate a distinct palette for coloring different clusters

distinctColors(
  n,
  hues = c("red", "cyan", "orange", "blue", "yellow", "purple", "green", "magenta"),
  saturation.range = c(0.7, 1),
  value.range = c(0.7, 1)
)

Arguments

n

Integer; Number of colors to generate

hues

Character vector of R colors available from the colors() function. These will be used as the base colors for the clustering scheme. Different saturations and values (i.e. darkness) will be generated for each hue.

saturation.range

Numeric vector of length 2 with values between 0 and 1. Default: c(0.25, 1)

value.range

Numeric vector of length 2 with values between 0 and 1. Default: c(0.5, 1)

Value

A vector of distinct colors that have been converted to HEX from HSV.

Examples

distinctColors(10)
#>  [1] "#FF4D4D" "#4DFFFF" "#FFC04D" "#4D4DFF" "#FFFF4D" "#BA4DFF" "#4DFF4D"
#>  [8] "#FF4DFF" "#B30000" "#00B3B3"