Skip to content

R package to assign random colors to unique items in a vector

Notifications You must be signed in to change notification settings

silastittes/as.color

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

as.color

This package is under review. Until posted to CRAN, please install using:

devtools::install_github("silastittes/as.color")

Working example

library(as.color)
#simple data frame with factorsset.seed(12345) #make results reproducible
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 = 0.5)
plotx <- as.integer(as.factor(fact))
plot(jitter(plotx), x, col=colz, pch=19, xaxt = "none")
axis(side = 1, at = plotx, labels = fact)

About

R package to assign random colors to unique items in a vector

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages