[R] Combine related plots

Sean Davis sdavis2 at mail.nih.gov
Wed Nov 16 14:52:25 CET 2005


On 11/16/05 8:48 AM, "Vivien W. Chen" <wxc203 at psu.edu> wrote:

> Dear R users,
> 
> If I have to combine plots which have the same independent and dependent
> variables in one graph. Which command should I use? Any example? Can I use
> "panel"?

Viven,

plot(x1,y1)
par(new=TRUE)
plot(x2,y2)

You may have to use xlim and ylim to get the plots to match axes.

Alternatively,

plot(x1,y1)
points(x2,y2) # or use lines, or whatnot

Sean




More information about the R-help mailing list