brewer.pal.factor: Build brewer.pal colors from factor (Deprecated)

View source: R/colors.R

brewer.pal.factorR Documentation

Build brewer.pal colors from factor (Deprecated)

Description

The functionality has been replaced by fcbrewer. The functions will be removed in the future release.

Usage

brewer.pal.factor(factor, name = "Greys")

Arguments

factor

A factor vector

name

Color panel name to be passed to brewer.pal

Details

The function is useful to build named RGB color values from factors. brewer.pal.factor return a color-HTML-string vector as the same length of the input factor vector, which is named by the input factor as well. brewer.pal.factorLevels returns a color vector of the length of the factor level, and the colors are named by the levels. See examples below.

From version 1.1-16, the color palette is automatically reduced/expanded when the levels of input factors underlies or exceeds the minimum and maximum colors. See example below.

Value

Named HTML RGB colors.

Author(s)

Jitao David Zhang <jitao_david.zhang@roche.com>

Examples


## Not run: 
myFac <- factor(c("HSV", "BVB", "FCB", "HSV", "BVB", "HSV"))
brewer.pal.factor(myFac, name="Set1")
brewer.pal.factorLevels(myFac, name="Set1")

myLongFac <- factor(paste("Sample", 1:20))
brewer.pal.factor(myLongFac, name="Set1")

myShortFac <- factor(paste("Sample", 1:2))
brewer.pal.factor(myShortFac, name="Set1")

## End(Not run)


bedapub/ribiosPlot documentation built on Sept. 1, 2023, 6:50 p.m.