Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试在 R 中使用 ggplot2 绘制 CDF,我得到以下图
但是数据的最小值和最大值是 1947 年和 2017 年。我不希望这条线超出范围 [1947, 2017]。
ggplot(df, aes(x=year)) + stat_ecdf(geom="line") + xlab("Year") + xlim(1947, 2017)
任何人都可以帮助解决这个问题吗?
尝试使用具有 FALSE 值的 pad 参数:
ggplot( data.frame(x=1947:2017), aes(x=x)) + stat_ecdf(geom="line", pad=FALSE)