[R] Plotting two overlapping curves
Dimitris Rizopoulos
d.rizopoulos at erasmusmc.nl
Thu Jul 30 17:46:18 CEST 2009
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
More information about the R-help
mailing list