Re: [R] plotting points in random but different colors based on condition

2009-10-13 Thread Jonathan Bleyhl
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: > >> g

Re: [R] plotting points in random but different colors based on condition

2009-10-10 Thread Jim Lemon
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 newg

Re: [R] plotting points in random but different colors based on condition

2009-10-10 Thread Jim Lemon
On 10/10/2009 11:10 AM, Jonathan Bleyhl wrote: On a similar note, I'm trying to plot continuous values on the y vs. categorical (dates) on the x and I want to color by date, but I want the colors to be random so points close to each other are easily distinguishable. Any thoughts? Thanks, Jon p

Re: [R] plotting points in random but different colors based on condition

2009-10-09 Thread Jonathan Bleyhl
On a similar note, I'm trying to plot continuous values on the y vs. categorical (dates) on the x and I want to color by date, but I want the colors to be random so points close to each other are easily distinguishable. Any thoughts? Thanks, Jon per freem-2 wrote: > > hi all, > > suppose I ha

Re: [R] plotting points in random but different colors based on condition

2009-08-05 Thread Juliet Hannah
Maybe this is helpful. Install ggplot2. #Create a small example x <- seq(1:20) y <- (2*x) + rnorm(length(x),0,1) id <- rep(1:5,each=4) dat <- data.frame(x,y,id) library(ggplot2) p <- ggplot(dat,aes(x=x,y=y,colour=factor(id))) p <- p + geom_point() p If this is not the correct structure, maybe i

[R] plotting points in random but different colors based on condition

2009-08-05 Thread per freem
hi all, suppose I have a file with several columns, and I want to plot all points that meet a certain condition (i.e. all points in columns A and B that have a value greater than such and such in column C of the data) in a new but random color. That is, I want all these points to be colored diffe