You are adding a scale to the x axis with xlim()
and then with scale_x_discrete()
. Instead, you should use the limits argument withing scale_x_discrete()
:
ggplot(df, aes(x=df$days, y=ecdf(df$days)(ComplianceDateDiff$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")+
scale_x_discrete(breaks = c(0,1,2,3,4,6,7), limits = c(-1, 8)