I have a ggplot geom_bar plot for a time series. I want to highlight the section from 11:00 to 19:00 with a rectangle.
Here is an image of the base graph and my attempt at a solution
ggplot(solution, aes(x = as.POSIXct(timeStamp, origin = "1970-01-01",
tz = "GMT-7"), y = as.integer(timeLength)/60, fill = running)) +
geom_bar(stat = "identity") +
xlab("")
y_max = (as.integer(solution$timeLength)/60) %>% max
y_min = 0
df_highlight <- solution %>%
#filter(hour %in% c(1,2,3,4,5,6)) %>%
group_by(date) %>%
summarise(xmin = as.POSIXct("02-02-2022 11:00:00.0", origin = "1970-01-01",
tz = "GMT-7"),
xmax = as.POSIXct("02-02-2022 19:00:00.0", origin = "1970-01-01",
tz = "GMT-7"))