as.color: Create a unique set of colors that matched the unique set of...

Description Usage Arguments Value Examples

View source: R/as.color.R

Description

Provided a vector of any class, the function will return a set of colors with the same length and order as the input vector. A random seed is used and will be printed in order to save desireable color palettes. Color transparency can also be modified.

Usage

1
as.color(x, alpha, seed)

Arguments

x

A vector of any class and length. x

alpha

A numeric value between 0 and 1 to control color transparency. Defualt is value is 0.5. alpha

seed

A value to seed the random colors. If not provided, a new palette of random colors will be generated with each call to the function.

Value

output a vector of hexidecimal colors of length x will be returned.

Examples

1
2
3
4
5
6
7
8
9
#simple data frame with factors
n <- 100
f <- 5
x <- sort(rnorm(n, mean = 0, sd = 50)) + rnorm(n, mean = 0, sd = 30)
fact <- rep(letters[1:5], each=n/f)
#call to as.color, with char vector
colz <- as.color(fact, alpha = 1)
plotx <- as.integer(as.factor(fact))
plot( jitter(plotx), x, col=colz, pch=19)

as.color documentation built on May 29, 2017, 3:59 p.m.

Related to as.color in as.color...