Re: [R] color ranges on a 2D plot

2008-01-17 Thread Petr PIKAL
[EMAIL PROTECTED] napsal dne 17.01.2008 15:08:40: > There must be a better way but this will do it for > you. > > x <- runif(100, 0, 1) > y <- runif(100, 0, 1) > z <- data.frame(x,y) > > plot(subset(z, z$y >=.5), col="red", ylim=c(min(z$y), > max(z$y)), pch=16) > points(subset(z, z$y <=.49), co

Re: [R] color ranges on a 2D plot

2008-01-17 Thread John Kane
There must be a better way but this will do it for you. x <- runif(100, 0, 1) y <- runif(100, 0, 1) z <- data.frame(x,y) plot(subset(z, z$y >=.5), col="red", ylim=c(min(z$y), max(z$y)), pch=16) points(subset(z, z$y <=.49), col="blue", pch=15) --- dxc13 <[EMAIL PROTECTED]> wrote: > > useR's >

Re: [R] color ranges on a 2D plot

2008-01-16 Thread Marc Schwartz
dxc13 wrote: > useR's > > I am trying to color the points on a scatter plot (code below) with two > colors. Red for values 0.5 -1.0 and blue for 0.0 - .49. Does anyone know a > easy way to do this? > > x<- runif(100, 0, 1) > y<- runif(100, 0, 1) > plot(y ~ x, pch=16) > > Thanks, > dxc13 You did

Re: [R] color ranges on a 2D plot

2008-01-16 Thread Greg Snow
You did not say what variable you want to be in the ranges to determine the colors, but try any of these to see if they do what you want: > x <- runif(100) > y <- runif(100) > z <- runif(100) > plot(x,y, pch=16, col=ifelse( x < 0.5, 'blue','red')) > plot(x,y, pch=16, col=ifelse( y < 0.5, 'blue','r