[R] two scatter plots in one

Jim Lemon jim at bitwrit.com.au
Thu Feb 12 10:09:39 CET 2009


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




More information about the R-help mailing list