Hi

Your files have only one column, so melted data is virtualy the same.

When I read  them as test1 and test2 i can do

plot(ecdf(test1$Down))
plot(ecdf(test2$Up), add=T, col=2)

Or using previously ustated ggplot2 package

test<-rbind(melt(test1),melt(test2))

p<-ggplot(test, aes(x=value, colour=variable))
p+stat_ecdf()

gives me 2 curves.

What is your problem?

Petr

BTW. please use preferably

dput(your.data)

for providing data for us.

From: Robin Mjelle [mailto:robinmje...@gmail.com]
Sent: Tuesday, April 16, 2013 11:09 PM
To: PIKAL Petr
Subject: Re: [R] Overlay two stat_ecdf() plots


Dear Petr,
I have attached the two tables that I want to plot using stat_ecdf().
To plot one of the table I use:

Down <- 
read.table("FC_For_top100Down_RegulatedMiRNATargetsClean.csv",sep="",header=T)
Down.m <- melt(Down,variable.name<http://variable.name>="DownFC")
ggplot(Down.m, aes(value)) + stat_ecdf()
This workes fine, but how do I plot both files in one plot?

On Tue, Apr 16, 2013 at 9:45 AM, PIKAL Petr 
<petr.pi...@precheza.cz<mailto:petr.pi...@precheza.cz>> wrote:
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-boun...@r-project.org<mailto:r-help-boun...@r-project.org> 
> [mailto:r-help-bounces@r-<mailto:r-help-bounces@r->
> project.org<http://project.org>] On Behalf Of Robin Mjelle
> Sent: Monday, April 15, 2013 1:10 PM
> To: r-help@r-project.org<mailto:r-help@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@r-project.org<mailto:R-help@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.


        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to