one way is the following:

x <- seq(-2, 2, len = 11)
y1 <- 2*x^2 + 3*x + 1
y2 <- - 2*x^2 - 3*x + 1

plot(x, y1, type = "l", col = "red", ylim = range(y1, y2))
lines(x, y2, col = "blue")


I hope it helps.

Best,
Dimitris


njhuang86 wrote:
Hi. Sorry if this question might have already been asked... I'm trying to
plot two curves on the same X-Y coordinate. The par(mfrow) command allows me
to plot the two curves on the same window however on different coordinate
systems. Is there a way to force the two curves into the same coordinate
system? Anyways, thanks in advance!

--
Dimitris Rizopoulos
Assistant Professor
Department of Biostatistics
Erasmus University Medical Center

Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands
Tel: +31/(0)10/7043478
Fax: +31/(0)10/7043014

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to