问题描述
我有DF
data.frame
。我想使用plot
cumulative distribution function (CDF)
中variables
的{{1}} DF
。使用以下代码会产生ggplot
,但由于plot
的数据范围较大,因此我对variables
的理解不太好。我不想使用plot
-希望将所有multiple facets
variables
放在plotted
上。
single panel
解决方法
我们可以使用facet_wrap
来标识
ggplot(DF,aes(x = value,col = variable))+
stat_ecdf(lwd = 1.2) +
facet_wrap(~ variable)
,
如果您不想使用构面,则可以使用对数刻度:
library(ggplot2)
set.seed(123)
DF <- reshape::melt(data.frame(p1 = runif(200,1,10),p2 = runif(200,-2,1),p3 = runif(200,0.05),p4 = runif(200,100,4000)))
ggplot(DF,col = variable),log='x')+
stat_ecdf(lwd = 1.2)+
scale_x_log10()