Skip to content
Prev 8917 / 15075 Next

plot 2 graphs on the same x-y plane

Hi,
A line can be added to an existing plot using the abline function.  For example, if a is the intercept and b is the slope, the command would be
   abline(a=a, b=b)

To overlay a new plot on an existing one, use the command: par(new=TRUE).  
For example:

plot(1:10, 1:10)
par(new=TRUE)
plot(log(1:10), 1:10)

This approach often leads to issues with the scale of the axes, tick marks, and labels.  Fortunately, R provides the flexibility to deal with all of them. I recommend you carefully read the help pages for plot, par, and axis, and have some fun playing around with all the options.

--Susan
On Apr 10, 2012, at 11:55 PM, Tawee Laoitichote wrote: