使用以下数据,即总秒数:
$head date-subtraction_total_seconds.csv
15806856.0
15806970.0
190922.0
860863.0
33441.0
15806835.0
84041.0
17197453.0
17195029.0
-48.0
我将数据拉入R:
df<-read.delim("date-subtraction.csv",sep=",",header=F)
df<-data.frame(seconds=df$V1,days=df$V1/86400)
我创建了一个 cdf:
ggplot(df, aes(x=df$days, y=ecdf(df$days)(df$days)))+
geom_step(size=2.2,color="red")+geom_step(color="cyan",size=1.5)+
scale_y_continuous(labels = percent_format(), limits=c(0,1))+
labs(x="Time (days)", y="% Total")+
ggtitle("Cumulative Distritubtion Function")+
xlim(-1,8)
当我尝试让 x 轴标签在特定点中断时,我收到一条奇怪的消息,关于添加另一个比例,图表发生变化,标签似乎堆叠在一起:
ggplot(df, aes(x=df$days, y=ecdf(df$days)(df$days)))+
geom_step(size=2.2,color="red")+geom_step(color="cyan",size=1.5)+
scale_y_continuous(labels = percent_format(), limits=c(0,1))+
labs(x="Time (days)", y="% Total")+
ggtitle("Cumulative Distritubtion Function")+
xlim(-1,8)+
scale_x_discrete(breaks = c(0,1,2,3,4,6,7))
"Scale for 'x' is already present. Adding another scale for 'x', which will replace the existing scale."
我需要创建一天作为一个因素吗?有没有另一种方法来创造这些休息?