目前我正在写我的学士论文,我所有的情节都是用 ggplot2 创建的。现在我需要两个 ecdfs 的图,但我的问题是两个数据帧的长度不同。但是通过添加值来均衡长度,我会改变分布,因此我的第一个想法是不可能的。但是禁止使用具有不同长度的两个不同数据帧的 ecdf 图。
daten <- peptidPSMotherExplained[peptidPSMotherExplained$V3!=-1,]
daten <- cbind ( daten , "scoreDistance"= daten$V2-daten$V3 )
daten2 <- peptidPSMotherExplained2[peptidPSMotherExplained2$V3!=-1,]
daten2 <- cbind ( daten2 , "scoreDistance"= daten2$V2-daten2$V3 )
p <- ggplot(daten, aes(x = scoreDistance)) + stat_ecdf()
p <- p + geom_point(aes(x = daten2$lengthDistance))
p
使用 R 的正常绘图功能,它是可能的
plot(ecdf(daten$scoreDistance))
plot(ecdf(daten2$scoreDistance),add=TRUE)
但它看起来与我所有的其他情节不同,我不喜欢这个。
有没有人为我解决?
谢谢你,托比亚斯
例子:
df <-data.frame(scoreDifference = rnorm(10,0,12))
df2 <- data.frame(scoreDifference = rnorm(5,-3,9))
plot(ecdf(df$scoreDifference))
plot(ecdf(df2$scoreDifference),add=TRUE)
那么如何在ggplot中实现这种情节呢?