【发布时间】:2014-01-24 10:11:23
【问题描述】:
此代码生成单个箱线图:
df <- data.frame(value = rnorm(62), my.date = seq(as.Date("2013-12-01"), as.Date("2014-01-31"), by="1 day"))
library(ggplot2)
ggplot(df, aes(as.Date(my.date), value)) + geom_boxplot() + scale_x_date(minor_breaks = "1 week", labels = date_format("%W\n%b"))
如何在 12 月 1 日至 1 月 31 日之间的每周生成一个包含单个箱线图的图?所以在单个图中,应该有大约 8 个箱线图。更喜欢使用ggplot() 或scale_x_date() 的解决方案。
【问题讨论】: