This code:
df <- data.frame(day <- 0:365, value = 1)
library(ggplot2)
ggplot(df, aes(day, value)) + geom_blank() + scale_x_continuous(breaks = seq(0, 365, 10)) + theme_bw()
Produces this plot:
Using R code, I want to shade the background of the plot according to which day
falls in which month. I want the plot to look like below (the plot background is Photoshopped). I would be particularly interested in a solution that uses lubridate
.
2
Answers
Probably not optimal, but I think it will work for you:
Here’s part of the solution using
geom_raster
.