[R] 2 scatter plots in the same graphic window....

Ben Bolker ben at zoo.ufl.edu
Wed Mar 26 20:08:32 CET 2003


  Either

n1 <- length(x1)
n2 <- length(x2)
plot(c(x1,x2),c(y1,y2),col=rep(c(1,2),c(n1,n2)), pch=rep(c(1,2),c(n1,n2))

OR

plot(x1,y1,xlim=range(c(x1,x2)),ylim=range(c(y1,y2)),col=1,pch=1)
points(x2,y2,col=2,pch=2)

will work.

  Ben Bolker

On Wed, 26 Mar 2003, Vasudevan, Geetha wrote:

> Hello,
> 
> I am trying to do a scatter plot of x1,y1 and x2,y2 in the same graphics
> window with diff col/pch values. i cannot get it to do them in the same
> window.
> 
> what is the cmd to do this? thanks.
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> 

-- 
318 Carr Hall                                bolker at zoo.ufl.edu
Zoology Department, University of Florida    http://www.zoo.ufl.edu/bolker
Box 118525                                   (ph)  352-392-5697
Gainesville, FL 32611-8525                   (fax) 352-392-3704



More information about the R-help mailing list