-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added function to put UK Whitsun publi choliday on a date plot
- Loading branch information
B.Anderson
committed
Jul 6, 2020
1 parent
abb3b9f
commit 0121498
Showing
1 changed file
with
18 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#' \code{addWhitsunDate} adds extended weekend shading and label for UK Whit Sunday (late spring bank holiday) where x axis is a date. Should work in any time-zone | ||
#' | ||
#' @param p the plot to add them to | ||
#' @param yMin the smallest y value | ||
#' @param yMax the largest y value | ||
#' @author Ben Anderson, \email{b.anderson@@soton.ac.uk} (original) | ||
#' @export | ||
#' | ||
addWhitsunDate <- function(p, yMin, yMax){ | ||
p <- p + annotate("rect", xmin = as.Date("2020-05-23"), | ||
xmax = as.Date("2020-05-26"), # 3 day weekend starting Saturday (in UK) | ||
ymin = yMin, ymax = yMax, | ||
alpha = gcParams$weAlpha, fill = gcParams$weFill) + | ||
annotate("text", x = as.Date("2020-05-24"), | ||
y = yMax*gcParams$labelPos, | ||
label = "Whitsun 2020") | ||
return(p) | ||
} |