I want highlight certain areas of a ggplot2 graph similar to what is done here: How to highlight time ranges on a plot?
I have a vector v 0 0 1 1 1 ...
which indicates at each time whether I want that part of the graph highlighted, yes or no. That is, contrary to the question above, I do not have the xmin and xmax values for each of the ranges that should be highlighted, but I also doubt this would work since I need more than one range to be highlighted.
Is there a way to write a plot statement for the highlighting with something like dates[v == 1]
(dates is the vector with dates for the x-axis of the plot)?
If not, is there another good way to do it?