【发布时间】:2013-03-28 12:24:55
【问题描述】:
我正在学习使用ggplot2,并正在寻找最小的ggplot2 代码,它可以重现下面的base::plot 结果。我已经尝试了一些东西,但它们最终都非常长,所以我正在寻找最小的表达式,理想情况下希望在 x 轴上有日期(不存在在下面的plot 中)。
df = data.frame(date = c(20121201, 20121220, 20130101, 20130115, 20130201),
val = c(10, 5, 8, 20, 4))
plot(cumsum(rowsum(df$val, df$date)), type = "l")
【问题讨论】:
标签: r ggplot2 cumulative-sum