【发布时间】:2021-07-29 02:27:29
【问题描述】:
我想更改 x 轴标签以显示星期一日期,而不是每个月的 1 日和 15 日。所以对于这个例子,我希望看到 6 月 7 日、6 月 14 日等等。
df = structure(list(Date = structure(c(18779, 18780, 18781, 18782,
18783, 18785, 18786, 18787, 18788, 18789, 18790, 18791, 18792,
18793, 18794, 18795, 18796, 18799, 18800, 18801, 18802, 18803,
18805, 18806, 18807, 18808, 18809, 18810, 18811, 18814, 18815,
18816, 18817, 18819, 18820, 18821, 18822, 18823, 18824, 18825,
18827, 18828), class = "Date"), Count = c(18L, 26L, 22L, 9L,
1L, 10L, 17L, 19L, 15L, 11L, 1L, 1L, 11L, 21L, 25L, 24L, 9L,
31L, 43L, 17L, 14L, 5L, 1L, 16L, 22L, 31L, 17L, 9L, 1L, 14L,
9L, 15L, 11L, 1L, 29L, 38L, 39L, 24L, 8L, 1L, 11L, 20L)), row.names = c(NA,
-42L), class = c("tbl_df", "tbl", "data.frame"))
ggplot(df, aes(x=Date, y=Count)) + geom_bar(stat="identity", fill="steelblue")
【问题讨论】: