5

Plotting an ecdf object in R produces a nice empirical distribution function. E.g:

x = seq(1,10,1)
ecdf1 = ecdf(x)
plot(ecdf1,verticals=TRUE, do.points=FALSE)

However, the default behavior produces a figure with horizontal dotted lines at 0 and 1. I don't see an option to turn off this behavior in plot.ecdf() or in the underlying call to plot.stepfun(). Right now, I'm literally drawing a white line overtop the dotted lines.

Surely there's a way to turn off drawing these dotted lines?

ecdf figure

Devon
  • 650
  • 8
  • 19

1 Answers1

9

Try:

plot(ecdf1,verticals=T, do.points=F,col.01line = NULL)

enter image description here

Reasoning: I used getAnywhere("plot.ecdf") and found the line abline(h = c(0, 1), col = col.01line, lty = 2). That's the cause. Since it uses col.01line as its input for color, we simply set the color to NULL.

slamballais
  • 3,161
  • 3
  • 18
  • 29
  • 1
    Good work, although sometimes you can just read the help page. In base-graphics the argument to a `col` parameter can also be "transparent". – IRTFM Feb 02 '16 at 20:43
  • Thanks, and nice explanation on how you found the solution! Not sure how I missed that one. – Devon Feb 02 '16 at 20:51