Dear all, I would like to plot under the same plot many curves like mycdf<-ecdf(runif(100)) plot(mycdf) curve(mycdf,from=-1,to=1) mycdf<-ecdf(runif(200)+3) plot(mycdf) curve(mycdf,from=-1,to=1) as you can see each new call to curve redraws (erases) the window. How I can have an effect like plot(mycdf) lines(mycdf2) lines(mycdf3) I would like to thank you in advance for your help Regards Alex [[alternative HTML version deleted]]
You can use lines() with ecdf objects or use the not-at-all-surprisingly-named add = TRUE parameter of curve(). Michael On Mon, Mar 26, 2012 at 10:44 AM, Alaios <alaios at yahoo.com> wrote:> Dear all, > I would like to plot under the same plot > many curves like > > mycdf<-ecdf(runif(100)) > plot(mycdf) > curve(mycdf,from=-1,to=1) > > > mycdf<-ecdf(runif(200)+3) > plot(mycdf) > curve(mycdf,from=-1,to=1) > > as you can see each new call to curve redraws (erases) the window. How I can have an effect like > plot(mycdf) > lines(mycdf2) > lines(mycdf3) > > I would like to thank you in advance for your help > > Regards > Alex > > ? ? ? ?[[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.
Hi If you went through help page you probably could find it yourself in shorter time then you spend writing email and waited for others to write back. see ?plot.stepfun> Dear all, > I would like to plot under the same plot > many curves like > > mycdf<-ecdf(runif(100)) > plot(mycdf) > curve(mycdf,from=-1,to=1)Why curve? Isn't plot enough?> > > mycdf<-ecdf(runif(200)+3) > plot(mycdf) > curve(mycdf,from=-1,to=1)Actually the value for mycdf in required interval is zero. To see the line you need to extend x and not to redraw the plot is ensured by add=TRUE. mycdf<-ecdf(runif(100)) plot(mycdf) curve(mycdf,from=-1,to=4) mycdf<-ecdf(runif(200)+3) curve(mycdf,add=TRUE, from=-1,to=4, col=2) Regards Petr> > as you can see each new call to curve redraws (erases) the window. How I> can have an effect like > plot(mycdf) > lines(mycdf2) > lines(mycdf3) > > I would like to thank you in advance for your help > > Regards > Alex > > [[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.