Generate categorical ColorBrewer palette. Specify one of 'labels' or 'n' to generate categorical color palette for use with 'scale_fill_manual(values = col.pal)' and 'scale_color_manual(values = col.pal)'

categoricalColPal(labels = NULL, n = NULL, palette = "Spectral")

Arguments

labels

vector of category names that if specified will have color assigned to. Default is NULL.

n

number of colors. Default is NULL. Ignored if 'labels' is specified.

palette

Name of palette. Default: "Spectral"

Value

Vector of colors. Named if labels provided.

Author

Nicholas Mikolajewicz

Examples


# generate color palette
col.pal <- categoricalColPal(n = 10)

# add to ggplot handle
gg.plt <- gg.plt + scale_fill_manual(values = col.pal)
#> Error in eval(expr, envir, enclos): object 'gg.plt' not found