Wednesday, February 27, 2008

R colors

R colors in a way that is intended to aid finding colors by name, or by index in the It contains 657 kinds of colors:
For example:
--------------------------------------------------------------------------
> colors()[c(552,254,26)]
[1] "red" "green" "blue"
> colors()[grep("red",colors())]
[1] "darkred" "indianred" "indianred1" "indianred2"
[5] "indianred3" "indianred4" "mediumvioletred" "orangered"
[9] "orangered1" "orangered2" "orangered3" "orangered4"
[13] "palevioletred" "palevioletred1" "palevioletred2" "palevioletred3"
[17] "palevioletred4" "red" "red1" "red2"
[21] "red3" "red4" "violetred" "violetred1"
[25] "violetred2" "violetred3" "violetred4"
> colors()[grep("sky",colors())]
[1] "deepskyblue" "deepskyblue1" "deepskyblue2" "deepskyblue3"
[5] "deepskyblue4" "lightskyblue" "lightskyblue1" "lightskyblue2"
[9] "lightskyblue3" "lightskyblue4" "skyblue" "skyblue1"
[13] "skyblue2" "skyblue3" "skyblue4"
> col2rgb("yellow")
[,1]
red 255
green 255
blue 0
--------------------------------------------------------------------
A full set of color image is here, download from the reference site.



The chart can be generate by the code:

setwd("C:/");
source("http://research.stowers-institute.org/efg/R/Color/Chart/ColorChart.R")

and check the pdf file under your your C: directory.


Reference:
http://research.stowers-institute.org/efg/R/Color/Chart/index.htm
http://www.stat.columbia.edu/~tzheng/files/Rcolor.pdf

No comments: