Thanks again Andy and Uwe for you help on my previous post of ploting lm coef and means. With your direction, I was able to expand and generalize the function to meet my requirements. Follow up question: Is it possible to make the points different colors depending on which quaderant they fall into? The data frame contains two variables (x and y) Quad 1 = x>mean(x) & y>mean(y) would be blue Quad 2 = x>mean(x) & y<mean(y) would be red Quad 3 = x<mean(x) & y>mean(y) .... Quad 4 = x<mean(x) & y<mean(y) .... Derek
plot color question
2 messages · Derek Margetts, Romain Francois
Hello
That would do the trick :
x <- rnorm(50)
y <- rnorm(50)
color <- rep("blue",50)
color[(x>0)&(y<0)] <-"red"
color[(x<0)&(y>0)] <-"green"
color[(x<0)&(y<0)] <-"yellow"
plot(x,y,col=color,pch=19)
abline(h=0) #just to check
abline(v=0) #just to check
Romain.
Derek Margetts a ??crit :
Thanks again Andy and Uwe for you help on my previous post of ploting lm coef and means. With your direction, I was able to expand and generalize the function to meet my requirements. Follow up question: Is it possible to make the points different colors depending on which quaderant they fall into? The data frame contains two variables (x and y) Quad 1 = x>mean(x) & y>mean(y) would be blue Quad 2 = x>mean(x) & y<mean(y) would be red Quad 3 = x<mean(x) & y>mean(y) .... Quad 4 = x<mean(x) & y<mean(y) .... Derek
______________________________________________ R-help at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Romain FRANCOIS : francoisromain at free.fr page web : http://addictedtor.free.fr/ (en construction) 06 18 39 14 69 / 01 46 80 65 60 _______________________________________________________ Etudiant en 3eme ann??e Institut de Statistique de l'Universit?? de Paris (ISUP) Fili??re Industrie et Services http://www.isup.cicrp.jussieu.fr/