Add transparent vertical slices, with boundaries specified by
the lower_date
and upper_date
arguments.
add_regime_shift_highlight(my_plot, lower_date = as.Date(c("1983-11-12", "1990-01-06", "1998-12-22", "2009-05-23")), upper_date = as.Date(c("1985-03-16", "1992-04-04", "1999-11-06", "2011-01-05")), alpha = 0.5, fill = "grey30")
my_plot | the original ggplot object |
---|---|
lower_date | a vector of the beginnings of the time spans |
upper_date | a vector of the ends of the time spans |
alpha | the transparency of the bars to add to the plot |
fill | the fill color of the bars to add to the plot |
A ggplot object with the bars added
The default values for the time spans correspond to the 0.90
credibility intervals estimated from
https://weecology.github.io/LDATS/paper-comparison.html. An alternative
default are the values from Christensen et al. 2018:
lower_date = as.Date(c("1983-12-01", "1988-10-01", "1998-09-01", "2009-06-01"))
upper_date = as.Date(c("1984-07-01", "1996-01-01", "1999-12-01", "2010-09-01"))