makeColorMatrix | R Documentation |
makeColorMatrix
is a convenience function for plotting with transparent colors.
makeColorMatrix()
This function take no arguments, but generates rows corresponding to red, blue, green, gray, purple and gold with increasing transparency moving from left to right across the columns.
A 6 x 5
matrix of colors.
rainbow
, col2rgb
, rgb
.
plot(1,1,col="white",xlim=c(0,10),ylim=c(0,10))
for(n in 1:6){rect(0:4,rep(8-n,5),1:5,rep(9-n,5),col=as.matrix(makeColorMatrix())[n,])}
#An example how it can be used in practice:
myData<-rnorm(600)
fact<-factor(c(rep("a",100),rep("b",100),rep("c",100),rep("d",100),rep("e",100),rep("f",100)))
plot(myData,col=makeColorMatrix()[fact,3])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.