[R] plotting points in random but different colors based	on	condition
    Jim Lemon 
    jim at bitwrit.com.au
       
    Sat Oct 10 10:44:57 CEST 2009
    
    
  
On 10/10/2009 06:41 PM, Jim Lemon wrote:
> Oops, should be:
> gimmeDiffCol<-function(oldcol) {
>  rgbcomp<-col2rgb(oldcol)
>  if(rgbcomp[1,1]<127) newred<-sample(rgbcomp[1,1]:255,1)/255
>  else newred<-sample(0:rgbcomp[1,1],1)/255
>  if(rgbcomp[2,1]<127) newgreen<-sample(rgbcomp[2,1]:255,1)/255
>  else newgreen<-sample(0:rgbcomp[2,1],1)/255
>   if(rgbcomp[3,1]<127) newblue<-sample(rgbcomp[3,1]:255,1)/255
>  else newblue<-sample(0:rgbcomp[3,1],1)/255
>  return(rgb(newred,newgreen,newblue))
> }
>
Jim
    
    
More information about the R-help
mailing list