On Mar 28, 2012, at 9:08 AM, Kevin Wright wrote:
They have hex RGB values instead of names:
R> heat.colors(5)
[1] "#FF0000FF" "#FF5500FF" "#FFAA00FF" "#FFFF00FF" "#FFFF80FF"
Kevin
The first one is the same as 'red' as can be seen by parsing the RGB
values above:
> col2rgb("red")
[,1]
red 255
green 0
blue 0
HC.m < matrix( c( strtoi( substr(heat.colors(5), 2,3), 16L),
strtoi(substr(heat.colors(5), 4,5), 16L),
strtoi(substr(heat.colors(5), 6,7), 16L) ), nrow=3, byrow=TRUE)
HC.m
[,1] [,2] [,3] [,4] [,5]
[1,] 255 255 255 255 255
[2,] 0 85 170 255 255
[3,] 0 0 0 0 128
One of the others 'yellow' is also in named colors:
> which( apply(col2rgb(colors()) , 2 , function(x) all( x == c(HC.m[,
2]))) )
integer(0)
> which( apply(col2rgb(colors()) , 2 , function(x) all( x == c(HC.m[,
3]))) )
integer(0)
> which( apply(col2rgb(colors()) , 2 , function(x) all( x == c(HC.m[,
1]))) )
[1] 552 553
> which( apply(col2rgb(colors()) , 2 , function(x) all( x == c(HC.m[,
4]))) )
[1] 652 653
> which( apply(col2rgb(colors()) , 2 , function(x) all( x == c(HC.m[,
5]))) )
integer(0)
> colors()[552: 553]
[1] "red" "red1"
> colors()[652:653]
[1] "yellow" "yellow1"
--
David.
On Wed, Mar 28, 2012 at 7:24 AM, YN Kim <y2sile...@gmail.com> wrote:
Hi all,
I'm trying to using heat.color function in my data visualization.
So, when
I set col = heat.color(5), five different colors are displayed from
red to
weak yellow.
But, now I want to know the color's keys or the names of the
displayed
heat.color. For instance, I think one of the five displayed colors
seems to
be 'red'. But, I'm not sure whether it is, also I don't know the
color
names for the others.
How can I know the exact colors name for that like 'red',
'darkyellow' and
so on?
Thanks.
YN
[[alternative HTML version deleted]]
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
--
Kevin Wright
[[alternative HTML version deleted]]
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
David Winsemius, MD
West Hartford, CT
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.