Reputation: 1575
I'm quite a beginner at using R for visualization of data. I've generated comulative distribution chart with following code:
if (length(first$dtl) > 0) {first_cdf <- ecdf(first$dtl)} else first_cdf <- 0
cdf_range <- range(0, first$dtl, na.rm=TRUE)
plot(first_cdf, main="Distribution", xlab="Values", xlim=cdf_range, col="#76B727", cex.axis=0.8, pch=20)
With this I get
Now issue is that I would like to get clear line instead of dots connected with line. I've tried to change pch as well as lty parameter, but it seems there is no way to get clear line with those. Any idea how to solve this issues?
Thank you and best regards!
Upvotes: 0
Views: 125
Reputation: 66819
This disables the dots and adds vertical lines to make it continuous:
set.seed(1)
plot(ecdf(rnorm(100)), do.points=FALSE, verticals=TRUE)
Type plot.ecdf
in at the R prompt to see the full function or ?plot.ecdf
for the help file (which directs further to ?plot.stepfun
). Even though you are calling vanilla plot
, the plot.ecdf
function is what's used, thanks to R's method dispatch, ?Methods
.
Upvotes: 1