[R] Overlay two stat_ecdf() plots

PIKAL Petr petr.pikal at precheza.cz
Tue Apr 16 09:45:01 CEST 2013


Hi

Do you mean ecdf? If yes just ose add option in plot.

plot(ecdf(rnorm(100, 1,2)))
plot(ecdf(rnorm(100, 2,2)), add=TRUE, col=2)

If not please specify from where is ecdf_stat or stat_ecdf which, as you indicate, are the same functions.

Regrdas
Petr




> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Robin Mjelle
> Sent: Monday, April 15, 2013 1:10 PM
> To: r-help at r-project.org
> Subject: [R] Overlay two stat_ecdf() plots
> 
> I want to plot two scdf-plots in the same graph.
> I have two input tables with one column each:
> 
> > Targets <- read.table("/media/....", sep="", header=T) NonTargets <-
> > read.table("/media/...", sep="", header=T)
> 
> > head(Targets)
>         V1
> 1 3.160514
> 2 6.701948
> 3 4.093844
> 4 1.992014
> 5 1.604751
> 6 2.076802
> 
> > head(NonTargets)
>          V1
> 1  3.895934
> 2  1.990506
> 3 -1.746919
> 4 -3.451477
> 5  5.156554
> 6  1.195109
> 
> > Targets.m <- melt(Targets)
> > head(Targets.m)
>   variable    value
> 1       V1 3.160514
> 2       V1 6.701948
> 3       V1 4.093844
> 4       V1 1.992014
> 5       V1 1.604751
> 6       V1 2.076802
> 
> > NonTargets.m <- melt(NonTargets)
> > head(NonTargets.m)
>   variable     value
> 1       V1  3.895934
> 2       V1  1.990506
> 3       V1 -1.746919
> 4       V1 -3.451477
> 5       V1  5.156554
> 6       V1  1.195109
> 
> 
> How do I proceed to plot them in one Graph using ecdf_stat()
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> 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.



More information about the R-help mailing list