[R] Split plot in colors/pch??

Joerg Maeder maeder at atmos.umnw.ethz.ch
Fri Mar 1 13:42:53 CET 2002


Hi Fredrik,

here is a very small example that should show the way to do it

d <- data.frame(x=c(1,2,3,4,5,6,4,3),y=1:8,g=c(1,2,1,2,3,1,2,3))#g
defines the group (color)
co <- c('red','green','blue')
plot(d$x,d$y,col=co[d$g])

same way for pch

gruess

joerg


Fredrik Karlsson wrote:
> 
> Hi all
> 
> This seems like a very easy question, but I have not found a simple
> answer to it:
> 
> If you have a dataframe, how to you plot two of then in different colors
> depending on a third variable?
> 
> All help appreciated!
> 
> /Fredrik
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

-- 
Joerg Maeder    .:|:||:..:.||.::   maeder at atmos.umnw.ethz.ch
Tel: +41 1 633 36 25   .:|:||:..:.||.::   
http://www.iac.ethz.ch/staff/maeder
PhD student at INSTITUTE FOR ATMOSPHERIC AND CLIMATE SCIENCE (IACETH)
ETH ZÜRICH Switzerland
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list