[R] ColorRamp different from ColorRampPalette
Etienne B. Racine
etiennebr at gmail.com
Fri Apr 17 21:42:04 CEST 2009
I try to use ColorRamp as ColorRampPalette (i.e. with the same gradient), but
it seems there is a nuance that I've missed.
pal.crp<-colorRampPalette( c("blue", "white", "red"), space = "rgb")
plot(rep(0,40),pch=16,col=pal.crp(40))
# is great
But, using the same gradient with colorRamp is giving erratic colors.
pal.cr<-colorRamp( c("blue", "white", "red"), space = "rgb")
plot(rep(0,40),pch=16,col=pal.cr((0:40)/40))
# is not great
>From the help : "colorRamp returns a function that maps values between 0 and
1 to colors" ...colors I guess taken from the gradient, but I don't get the
gradient.
Etienne
--
View this message in context: http://www.nabble.com/ColorRamp-different-from-ColorRampPalette-tp23104641p23104641.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list