mtb954@gmail.com
2005-Oct-19 23:50 UTC
[R] Plotting more than one series on the same graph
I'm new to R and have searched for help and consulted the the pdf manuals, but I can't seem to figure out how to plot more than one series on the same graph. I've tried using multiple par(new=TRUE) statements such as>plot(series1, ci.type="line", col="red", lwd=2, ci.lty=0, ci.col="red") >par(new=TRUE) >plot(series2, ci.type="line", col="green", lwd=2, ci.lty=0, ci.col="green") >par(new=TRUE) >plot(series3, ci.type="line", col="blue", lwd=2, ci.lty=0, ci.col="blue")and this does plot the three series on one graph, but makes a mess of the y-axis. There must be a more elegant solution. Also, I wonder why the final series (series 3) doesn't plot until I manually hit <enter>? Thanks for any help, Mark
Sundar Dorai-Raj
2005-Oct-20 00:00 UTC
[R] Plotting more than one series on the same graph
mtb954 at gmail.com wrote:> I'm new to R and have searched for help and consulted the the pdf > manuals, but I can't seem to figure out how to plot more than one > series on the same graph. > > I've tried using multiple par(new=TRUE) statements such as > > >>plot(series1, ci.type="line", col="red", lwd=2, ci.lty=0, ci.col="red") >>par(new=TRUE) >>plot(series2, ci.type="line", col="green", lwd=2, ci.lty=0, ci.col="green") >>par(new=TRUE) >>plot(series3, ci.type="line", col="blue", lwd=2, ci.lty=0, ci.col="blue") > > > and this does plot the three series on one graph, but makes a mess of > the y-axis. > > There must be a more elegant solution. > > Also, I wonder why the final series (series 3) doesn't plot until I > manually hit <enter>? > > Thanks for any help, Mark >Hi, Mark, In general, see ?lines. However, your use of "ci.type" suggests you're using ?plot.acf, which may require you describe what you are trying to do in more detail. Thanks, --sundar