Hi, I have a number (correlation coefficient) "x" in [-1,1], and a color palette col<-grey(1:N/N) for a given N. I want to assign a color from "col" to "x" which corresponds to "x" in levels of cut(-1:1,N). So for N<-4 and x<-0.3, the color should be col[3]. For N<-4 and x<--0.8, the color should be col[1], etc. Thank you for your help, Serguei [[alternative HTML version deleted]]
>I have a number (correlation coefficient) "x" in [-1,1], and a color >palette col<-grey(1:N/N) for a given N. I want to assign a color from "col" >to "x" which corresponds to "x" in levels of cut(-1:1,N). > >So for N<-4 and x<-0.3, the color should be col[3]. For N<-4 and x<--0.8, >the color should be col[1], etc.findInterval(-0.3,seq(-1,1,2/4)) HTH ido