Re: [R] lines, ecdf and colors

From: Thomas Petzoldt <thpe_at_simecol.de>
Date: Sat, 08 Nov 2008 19:57:25 +0100

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.



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. Received on Sat 08 Nov 2008 - 19:00:07 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 08 Nov 2008 - 19:30:27 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive