Skip to content
Prev 361689 / 398506 Next

Dashed/dotted ecdf plots using lots of points

(a) ecdf() could be an overkill for this. At 10000 points, plot(sort(x), ppoints(x), type="l") should be quite close enough. Also, plot.ecdf() draws lots of individual horisontal line segments which all start in the same way. If you have enough of them, they reduce to a single pixels which are all "on". If you draw a continuous line, at least there is a chance to get dotting and dashing to work. However...

(b) It is a generic problem to get dash/dot patterns to cycle correctly along multisegment lines. Some device drivers are better at it than others. 

The following looks OK for me, but not on the quartz() screen device. 

pdf()
x <- rnorm(10000)
plot(sort(x),ppoints(x),type="l",lty="dashed", ylim=c(0,1))
plot(sort(x),ppoints(x),type="l",lty="dotted", ylim=c(0,1))
dev.off()

-pd