Skip to content

Commit

Permalink
amended so that just adds global public holidays (although actually E…
Browse files Browse the repository at this point in the history
…aster varies too - e.g. orthodox)
  • Loading branch information
B.Anderson committed Jul 6, 2020
1 parent 0121498 commit 93a9c42
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
8 changes: 6 additions & 2 deletions R/addVeDayDate.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' \code{addVeDayDate} adds label for VE day 2020 where x axis is a date. Should work in any time-zone
#' \code{addVeDayDate} adds extended weekend shading and label for VE day 2020 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
Expand All @@ -7,7 +7,11 @@
#' @export
#'
addVeDayDate <- function(p, yMin, yMax){
p <- p + annotate("text", x = as.Date("2020-05-08"),
p <- p + annotate("rect", xmin = as.Date("2020-05-08"),
xmax = as.Date("2020-05-11"), # 3 day weekend starting Friday (in UK)
ymin = yMin, ymax = yMax,
alpha = gcParams$weAlpha, fill = gcParams$weFill) +
annotate("text", x = as.Date("2020-05-08"),
y = yMax*gcParams$labelPos,
label = "VE Day 2020")
return(p)
Expand Down
8 changes: 6 additions & 2 deletions R/addVeDayDateTime.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' \code{addVeDayDateTime} adds label for VE day 2020 where x axis is a dateTime. Should work in any time-zone.
#' \code{addVeDayDateTime} adds extended weekend shading and label for VE day 2020 where x axis is a dateTime. Should work in any time-zone.
#'
#' @param p the plot to add them to
#' @param yMin the smallest y value
Expand All @@ -7,7 +7,11 @@
#' @export
#'
addVeDayDateTime <- function(p, yMin, yMax){
p <- p + annotate("text", x = lubridate::as_datetime("2020-05-08 12:00:00"),
p <- p + annotate("rect", xmin = lubridate::as_datetime("2020-05-08 00:00:00"),
xmax = lubridate::as_datetime("2020-05-10 23:59:59"), # 3 day weekend starting Friday (in the UK)
ymin = yMin, ymax = yMax,
alpha = gcParams$weAlpha, fill = gcParams$weFill) + # VE Day
annotate("text", x = lubridate::as_datetime("2020-05-08 12:00:00"),
y = yMax*gcParams$labelPos,
label = "VE Day 2020")
return(p)
Expand Down
4 changes: 2 additions & 2 deletions R/addWeekendRectsDate.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ addWeekendRectsDate <- function(p, yMin, yMax){
xmax = as.Date("2020-05-04"),
ymin = yMin, ymax = yMax,
alpha = gcParams$weAlpha, fill = gcParams$weFill) +
annotate("rect", xmin = as.Date("2020-05-08"),
annotate("rect", xmin = as.Date("2020-05-09"),
xmax = as.Date("2020-05-11"),
ymin = yMin, ymax = yMax,
alpha = gcParams$weAlpha, fill = gcParams$weFill) + # VE Day
alpha = gcParams$weAlpha, fill = gcParams$weFill) +
annotate("rect", xmin = as.Date("2020-05-16"),
xmax = as.Date("2020-05-18"),
ymin = yMin, ymax = yMax,
Expand Down
2 changes: 1 addition & 1 deletion R/addWeekendRectsDateTime.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ addWeekendRectsDateTime <- function(p, yMin, yMax){
xmax = lubridate::as_datetime("2020-05-03 23:59:59"),
ymin = yMin, ymax = yMax,
alpha = gcParams$weAlpha, fill = gcParams$weFill) +
annotate("rect", xmin = lubridate::as_datetime("2020-05-08 00:00:00"),
annotate("rect", xmin = lubridate::as_datetime("2020-05-09 00:00:00"),
xmax = lubridate::as_datetime("2020-05-10 23:59:59"),
ymin = yMin, ymax = yMax,
alpha = gcParams$weAlpha, fill = gcParams$weFill) + # VE Day
Expand Down

0 comments on commit 93a9c42

Please sign in to comment.