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

Jonathan Bleyhl Jonathan_Bleyhl at affymetrix.com
Sat Oct 10 02:10:11 CEST 2009

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?


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 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-tp24837716p25829680.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list