powered by
val2col - Convert a numeric vector into colors
val2col( z, col1 = "navy", col2 = "white", col3 = "red3", nbreaks = 1000, center = TRUE, rank = FALSE )
a vector of colors
a vector of numbers
a color name for the min value, default 'navy'
a color name for the middle value, default 'white'
a color name for the max value, default 'red3'
Number of colors to be generated. Default is 30.
boolean, should the data be centered? Default is TRUE
boolean, should the data be ranked? Default is FALSE
a<-rnorm(1000) cols<-val2col(a) plot(a,col=cols,pch=16)
Run the code above in your browser using DataLab