[R] plotting points in random but different colors based on condition
Jonathan Bleyhl
Jonathan_Bleyhl at affymetrix.com
Mon Oct 12 18:17:13 CEST 2009
I guess I didn't mention that I'm trying to do this in ggplot2 where I have
my color set up via:
geom_point(aes(colour = Date))
Not sure how to implement your suggestion within the confines of ggplot2.
Jim Lemon-2 wrote:
>
> 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
>
> ______________________________________________
> R-help at 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.
>
>
--
View this message in context: http://www.nabble.com/plotting-points-in-random-but-different-colors-based-on-condition-tp24837716p25858707.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list