Dear list, I want to combine several plots in one graph. I did this: plot(a1); plot(a2, add=TRUE); ...plot(a5, add=TRUE) The problem is the more plot we put, the more complex the graph. Is there any way to label each line; or other way just to make sure I know which one which? Thank you for the help, Ilham [[alternative HTML version deleted]]
You can use color (col=), line type (lty=), line width (lwd=), plot character (pch=) --- take you choice. \the more plot we put, the more complex the graph.> Is there any way to label each line; or other way just to make sure I know > which one which? > > Thank you for the help, > Ilham > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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. >-- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve?
"G Ilhamto" <gilhamto at gmail.com> wrote in news:bebd16360711232355q5e1e68eeke177f7f061829d9c at mail.gmail.com:> I want to combine several plots in one graph. > I did this: plot(a1); plot(a2, add=TRUE); ...plot(a5, add=TRUE) > The problem is the more plot we put, the more complex the graph. > Is there any way to label each line; or other way just to make sure I > know which one which? >Try: ?legend This is a worked example taken from Seefeld and Kim's monograph: <http://cran.r-project.org/doc/contrib/Seefeld_StatsRBio.pdf> plot(x,dgamma(x,shape=2,scale=1), type='l',xlab="x", ylab="f(x)", main="Gamma pdf's") lines(x,dgamma(x,shape=2,scale=2),lty=2) lines(x,dgamma(x,shape=2,scale=4),lty=3) lines(x,dgamma(x,shape=2,scale=8),lty=4) legend(x=10,y=.3,paste("Scale=",c(1,2,4,8)),lty=1:4) -- David Winsemius
Hi r-help-bounces at r-project.org napsal dne 24.11.2007 08:55:54:> Dear list, > > I want to combine several plots in one graph. > I did this: plot(a1); plot(a2, add=TRUE); ...plot(a5, add=TRUE) > The problem is the more plot we put, the more complex the graph. > Is there any way to label each line; or other way just to make sure Iknow> which one which?Did you consider ?lines Regards Petr> > Thank you for the help, > Ilham > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html> and provide commented, minimal, self-contained, reproducible code.