Hi. I'm trying to plot two ecdf's on the same graph using two different colors. I can plot using the same color, but it doesn't work when I change colors? Any suggestions? Thanks in advance for your help. x <- c(0.80, 0.83, 1.89, 1.04, 1.45, 1.38, 1.91, 1.64, 0.73, 1.46) y <- c(1.15, 0.88, 0.90, 0.74, 1.21) plot(ecdf(x)) # it works without col='blue', but doesn't with it lines(ecdf(y), col = "blue")
eric lee wrote:> Hi. I'm trying to plot two ecdf's on the same graph using two > different colors. I can plot using the same color, but it doesn't > work when I change colors? Any suggestions? Thanks in advance for > your help. > > x <- c(0.80, 0.83, 1.89, 1.04, 1.45, 1.38, 1.91, 1.64, 0.73, 1.46) > y <- c(1.15, 0.88, 0.90, 0.74, 1.21) > plot(ecdf(x)) > # it works without col='blue', but doesn't with it > lines(ecdf(y), col = "blue")Does the following what you expect: x <- c(0.80, 0.83, 1.89, 1.04, 1.45, 1.38, 1.91, 1.64, 0.73, 1.46) y <- c(1.15, 0.88, 0.90, 0.74, 1.21) plot(ecdf(x)) lines(ecdf(y), col.points = "blue", col.hor = "blue") See ?plot.ecdf and especially ?plot.stepfun for details. HTH Thomas P.
Try: plot(ecdf(x)) lines(ecdf(y), col.hor='blue') see ?plot.stepfun On Sat, Nov 8, 2008 at 1:39 PM, eric lee <ericlee100 at gmail.com> wrote:> Hi. I'm trying to plot two ecdf's on the same graph using two > different colors. I can plot using the same color, but it doesn't > work when I change colors? Any suggestions? Thanks in advance for > your help. > > x <- c(0.80, 0.83, 1.89, 1.04, 1.45, 1.38, 1.91, 1.64, 0.73, 1.46) > y <- c(1.15, 0.88, 0.90, 0.74, 1.21) > plot(ecdf(x)) > # it works without col='blue', but doesn't with it > lines(ecdf(y), col = "blue") > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve?