[R] plot color question

Romain François francoisromain at free.fr
Mon Dec 6 22:55:57 CET 2004


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/




More information about the R-help mailing list