[R] many curves to the same plot

Petr PIKAL petr.pikal at precheza.cz
Mon Mar 26 17:01:58 CEST 2012


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 guide 
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list