0
我有一個data.frame,我想繪製edcf行。大約有96個pos ecf線和96個ec ecf線。我想將pos線黑色和neg線紅色。我還想增加透明度或平均線,以免看起來雜亂無章。也許只包括傳說中的pos和neg。着色ggplot2的基於stat_ecdf行的示例分隔符
代碼:
simplify <- function(x){
temp = x[complete.cases(x),]
df.m = reshape2::melt(temp, id.vars = NULL)
df.m$XIST = sapply(strsplit(as.character(df.m$variable), "_", fixed=TRUE), function(x) (x[1]))
return(df.m)
}
temp = simplify(X_chr)
ggplot(temp, aes(value, colour=variable)) + stat_ecdf() + xlim(1,1000) + theme_bw()
Temp
看起來是這樣的:
> head(temp, 10)
variable value XIST
1 pos_A1 0.00000 pos
2 pos_A1 0.00000 pos
3 pos_A1 0.00000 pos
4 pos_A1 0.00000 pos
5 pos_A1 0.00000 pos
6 pos_A1 15.66911 pos
7 pos_A1 0.00000 pos
8 pos_A1 0.00000 pos
9 pos_A1 0.00000 pos
10 pos_A1 0.00000 pos
> tail(temp, 10)
variable value XIST
210999 neg_H9 0.000000 neg
211000 neg_H9 0.000000 neg
211001 neg_H9 0.000000 neg
211002 neg_H9 0.000000 neg
211003 neg_H9 0.000000 neg
211004 neg_H9 4.466276 neg
211005 neg_H9 0.000000 neg
211006 neg_H9 0.000000 neg
211007 neg_H9 0.000000 neg
211008 neg_H9 30.033764 neg
產地:
您可以通過點擊勾選了關閉這個問題,緊挨着我的回答。 – shayaa