我想在我的图表的每一天中午添加日轴标签。目前,它在午夜添加了标签,但如果这些标签每天中间间隔一段距离,我更喜欢它,同时保留表示午夜的网格线。我尝试使用hjust
,但结果看起来不太好。有没有办法做到这一点?ggplot2图表中每天中午都会打破轴线
library(ggplot2)
library(scales)
dat <- data.frame(time_value=seq(as.POSIXct("2011-07-01"), length.out=24*30, by = "hours"),
usage_value=sample(1:10, 24*30, replace=TRUE),
group=1)
dat$week <- format(dat$time_value, '%W')
dat <- subset(dat, week == 27)
ggplot(dat, aes(x=time_value, y=usage_value, group=1)) +
scale_x_datetime(breaks='day', labels=date_format('%A')) +
geom_line()
不知道,但也许看看''符= date_breaks使用date_breaks(...) '' – Idr 2012-04-25 20:28:05