I am trying to show the effect equinoxes have on my data, a series of remotely-tracked birds for a whole year. In order to do that I want to plot latitude for each day of the year and have the equinox effect as a color grading in the background.
My data would look something like this:
SO <- data.frame(date = seq(as.Date("2000/1/1"), by = "day", length.out = 365),
latitude = cumsum(rnorm(365)),
eqx.effect = c(rep(0,60),seq(1,20,1), seq(20,1,-1),rep(0,143),seq(1,20,1), seq(20,1,-1),rep(0,82)),
location = c(rep(1,100),rep(2,135), rep(3,130)))
So far I have managed to plot latitude for the whole year for several birds with geom_line and color different parts of the lines with different colors according to the location at which they are at. In order to change the background I have read of the use of geom_rect in Using ggplot2 in R, how do I make the background of a graph different colours in different regions? but in that question the man only needs a bunch of rectangles and I would need 365.
Does anyone know any other way of doing this? If I could make the default background more transparent on the dates closer to the equinoxes it would also be useful.