[R] ggplot2 scale_shape question
Is there a way to have some points solid and some points hollow? I have two classes of points and there are so many points, that it's hard to see just the difference in shapes. I'd like to have one of the classes be hollow in addition to being a different shape. Any help would be grand. Thanks, Jon -- View this message in context: http://www.nabble.com/ggplot2-scale_shape-question-tp25882277p25882277.html Sent from the R help mailing list archive at Nabble.com. __ R-help@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.
Re: [R] plotting points in random but different colors based on condition
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@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. __ R-help@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.
Re: [R] plotting points in random but different colors based on condition
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 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 differently but I dont care what color. The only concern is that the points will be colored as differently from each other as possible. The specific example I have is a file with three columns, X, Y and ID. I want to plot all rows from X, Y (i.e. all points) that have the same value (say 1) in their ID column as one color, all points from X, Y that have the same ID column value (say 2) as a different color, etc. I dont know ahead of time how many values the ID column will have so I can't write a separate plot statement for each of these sets of X, Y rows that have the same ID value. Is there a way to express this in R? thank you. Is there a way to do this? [[alternative HTML version deleted]] __ R-help@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-tp24837716p25829680.html Sent from the R help mailing list archive at Nabble.com. __ R-help@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.