data <- c(1.3, 0.3, 1.8, 0.1, 0.9, 1.2, 0.6, 1.9, 0.4, 1.6)
sort(data)

Fn <- ecdf(data)
plot(Fn, main = "Empirical CDF vs Uniform(0,2) CDF",
     xlab = "x", ylab = "F(x)", xlim = c(-0.5, 2.5),
     col = "blue", lwd = 2)
curve(punif(x, 0, 2), from = -0.5, to = 2.5,
      add = TRUE, col = "red", lwd = 2, lty = 2)
legend("topleft", c("Empirical CDF", "Uniform(0,2) CDF"),
       col = c("blue", "red"), lty = c(1, 2), lwd = 2)

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: