I am having difficulty plotting an ECDF
function for a variable. The simple code below provides an example;
A = rnorm(100)
plot(ecdf(A),
abline(v=c(-1,1,1.5)))
When I attempt to plot the function with vertical lines the warning message
Error in int_abline(a = a, b = b, h = h, v = v, untf = untf, ...) :
plot.new has not been called yet
appears.
I have searched a number of sources but I have not been able to identify what mistake I am making. If anyone could provide information on how to plot these ecdf
plots and then add vertical lines I would greatly appreciate it.
Thanks.
Everything is correct except that you first have to plot the graph
plot(ecdf(A))
And then you can add the abline
. As Roland said, abline
is not a function of plot (in contrast to ggplot2
)
abline(v=c(-1,1,1.5)))