Dear R-users, I have to plot a exponential distribution like the plot in the pdf attached. I've write this code but I don't know how to draw the two lines.. Can anyone help me please? Thank you very much Pippo http://r.789695.n4.nabble.com/file/n3394476/exponential_smoothing.pdf exponential_smoothing.pdf -- View this message in context: http://r.789695.n4.nabble.com/Exponential-distribution-tp3394476p3394476.html Sent from the R help mailing list archive at Nabble.com.
The code is like this: plot(0,0, type="n", xlim=c(1,15), ylim=0:1, xlab="...", ylab="...", main="Example) lines(1:15, line1, col=4) lines(1:15, line2, col=2) legend("topright", c("alpha = 0.2", "alpha = 0.4"), col=c(4,2), lty=1) How can I build the vectors line1 and line2 ? -- View this message in context: http://r.789695.n4.nabble.com/Exponential-distribution-tp3394476p3395057.html Sent from the R help mailing list archive at Nabble.com.
Try this x <- seq(0,15,0.01) plot(x+1, dexp(x, 0.2), c(0,15), c(0,0.8),type="l", ylab="f(x)") lines(x+1, dexp(x, 0.8)) grid() abline(v=1, col="lightgray", lty="dotted",) Best ep -- View this message in context: http://r.789695.n4.nabble.com/Exponential-distribution-tp3394476p3395829.html Sent from the R help mailing list archive at Nabble.com.