Dear R-gurus: How do I overlay 2 plots in the same frame in R? Or, if I have a histogram, and I want to plot a function in the same frame - how do I do it? Thank you very much, Vlad -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Vlad, This is typically achieved by drawing your 'main' plot first, then adding points, lines, etc to it for whatever else you want to plot. For instance > x <- rnorm(1000) > tmp <- hist(x) > points(tmp$mids, tmp$counts) > abline(v=mean(x), col="red", lwd=2, lty=3) Regards, Andrew C. Ward CAPE Centre Department of Chemical Engineering The University of Queensland Brisbane Qld 4072 Australia andreww at cheque.uq.edu.au On Tuesday, October 22, 2002 9:40 AM, Vladimir Morozov [SMTP:VBMorozov at lbl.gov] wrote:> Dear R-gurus: > > How do I overlay 2 plots in the same frame in R? > Or, if I have a histogram, and I want to plot a function in the sameframe -> how do I do it? > > Thank you very much, > Vlad > > >-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. -.-.-.-> r-help mailing list -- Readhttp://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html> Send "info", "help", or "[un]subscribe" > (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch >_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._. _._._._ -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On 21 Oct 2002 at 16:39, Vladimir Morozov wrote:> Dear R-gurus:I would not call myself anything like that, but anyway, you should be more specific in your questions. ppp <- rnorm(1000) hist(ppp, prob=T) lines(density(ppp)) for instance these three lines will give you a histogram with a line density plot. And I definitely recommend you RTFM (especially An introduction to R) and help files for plot.> > How do I overlay 2 plots in the same frame in R? > Or, if I have a histogram, and I want to plot a function in the same > frame - how do I do it? > > Thank you very much, > Vlad > > > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. > -.-.-.-.- r-help mailing list -- Read > http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", > or "[un]subscribe" (in the "body", not the subject !) To: > r-help-request at stat.math.ethz.ch > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._. > _._._._._Petr Pikal petr.pikal at precheza.cz p.pik at volny.cz -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._