Re: [R] two scatter plots in one

2009-02-12 Thread baptiste auguie
lattice and ggplot2 also offer a general way of doing this, # first create a data.frame in the long format containing the two data sets x1 <- seq(-10, 10) x2 <- seq(-8, 12) y1 <- sin(x1/3) y2 <- cos(x2/2) d1 <- data.frame(x=x1, y=y1, var="1") d2 <- data.frame(x=x2, y=y2, var="2") library(res

Re: [R] two scatter plots in one

2009-02-12 Thread Jim Lemon
liujb wrote: Dear R users, I need to compare two scatter plots, plot(x1, y1) plot(x2, y2) and would like to plot them in the same figure. How do I do it? Hi liujb, How about this: plot(x1,y1,xlim=range(c(x1,x2)),ylim=range(c(y1,y2)),col="red") points(x2,y2,col="blue") Jim _

Re: [R] two scatter plots in one

2009-02-11 Thread jim holtman
Set the xlim/ylim to the extent of the data and then do plot(x1, y1, xlim=range(x1, x2), ylim=range(y1, y2)) points(x2, y2, col='red') On Wed, Feb 11, 2009 at 3:43 PM, liujb wrote: > > Dear R users, > > I need to compare two scatter plots, > plot(x1, y1) > plot(x2, y2) > > and would like to plot

[R] two scatter plots in one

2009-02-11 Thread liujb
Dear R users, I need to compare two scatter plots, plot(x1, y1) plot(x2, y2) and would like to plot them in the same figure. How do I do it? Thank you. -- View this message in context: http://www.nabble.com/two-scatter-plots-in-one-tp21963375p21963375.html Sent from the R help mailing list a