I would like to add day axis labels at noon for each day of my chart. Currently, it adds the labels at midnight, but I'd prefer it if those labels were spaced midway between each day, while retaining grid lines denoting midnight. I tried using hjust
but the results didn't look very good. Is there a way to do this?
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()