Plot 2 graphs in same plot in R?

Posted by Sandra Schlichting on Stack Overflow See other posts from Stack Overflow or by Sandra Schlichting
Published on 2010-04-01T23:28:14Z Indexed on 2010/04/01 23:33 UTC
Read the original article Hit count: 572

Filed under:
|

I would like to plot y1 and y2 in the same plot.

x  <- seq(-2, 2, 0.05)
y1 <- pnorm(x)
y2 <- pnorm(x,1,1)
plot(x,y1,type="l",col="red")
plot(x,y2,type="l",col="green")

But when I do it like this, they are not plotted in the same plot together.

In Matlab can one do hold on, but does anyone know how to do this in R?

© Stack Overflow or respective owner

Related posts about r

    Related posts about statistics