-
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.
- Loading branch information
B.Anderson
committed
Jul 8, 2020
1 parent
5d050bf
commit b97eb0e
Showing
9 changed files
with
75 additions
and
17 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
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 |
---|---|---|
@@ -1,18 +1,19 @@ | ||
#' \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 yLoc the reltative height of the label (so you can stagger them on a plot) | ||
#' @param yMin the smallest y value | ||
#' @param yMax the largest y value | ||
#' @author Ben Anderson, \email{b.anderson@@soton.ac.uk} (original) | ||
#' @export | ||
#' | ||
addVeDayDate <- function(p, yMin, yMax){ | ||
addVeDayDate <- function(p, yLoc, yMin, yMax){ | ||
p <- p + annotate("rect", xmin = as.Date("2020-05-08"), | ||
xmax = as.Date("2020-05-11"), # 3 day weekend starting Friday (in UK) | ||
xmax = as.Date("2020-05-09"), # 3 day weekend starting Friday (in UK) | ||
ymin = yMin, ymax = yMax, | ||
alpha = gcParams$weAlpha, fill = gcParams$weFill) + | ||
alpha = 0.5, fill = gcParams$weFill) + #gcParams$weAlpha | ||
annotate("text", x = as.Date("2020-05-08"), | ||
y = yMax*gcParams$labelPos, | ||
y = yLoc * yMax, | ||
label = "VE Day 2020") | ||
return(p) | ||
} |
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 |
---|---|---|
@@ -1,18 +1,20 @@ | ||
#' \code{addVeDayDateTime} adds extended weekend shading and 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 yLoc the relative location of the label (% of max plot height) | ||
#' @param yMin the smallest y value | ||
#' @param yMax the largest y value | ||
#' @author Ben Anderson, \email{b.anderson@@soton.ac.uk} (original) | ||
#' @export | ||
#' | ||
addVeDayDateTime <- function(p, yMin, yMax){ | ||
addVeDayDateTime <- function(p, yLoc, yMin, yMax){ | ||
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, | ||
y = yLoc * yMax, | ||
label = "VE Day 2020") | ||
return(p) | ||
} |
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 |
---|---|---|
@@ -1,18 +1,19 @@ | ||
#' \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 yLoc the reltative height of the label (so you can stagger them on a plot) | ||
#' @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"), | ||
addWhitsunDate <- function(p, yLoc, yMin, yMax){ | ||
p <- p + annotate("rect", xmin = as.Date("2020-05-25"), | ||
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, | ||
alpha = 0.5, fill = gcParams$weFill) + | ||
annotate("text", x = as.Date("2020-05-25"), | ||
y = yLoc * yMax, | ||
label = "Whitsun 2020") | ||
return(p) | ||
} |
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,20 @@ | ||
#' \code{addWhitsunDate} adds extended weekend shading and label for UK Whit Sunday (late spring bank holiday) | ||
#' where x axis is a dateTime. Should work in any time-zone | ||
#' | ||
#' @param p the plot to add them to | ||
#' @param yLoc the reltative height of the label (so you can stagger them on a plot) | ||
#' @param yMin the smallest y value | ||
#' @param yMax the largest y value | ||
#' @author Ben Anderson, \email{b.anderson@@soton.ac.uk} (original) | ||
#' @export | ||
#' | ||
addWhitsunDateTime <- function(p, yLoc, yMin, yMax){ | ||
p <- p + annotate("rect", xmin = as.Date("2020-05-25 00:00:00"), | ||
xmax = as.Date("2020-05-25 23:59:59"), # 3 day weekend starting Saturday (in UK) | ||
ymin = yMin, ymax = yMax, | ||
alpha = 0.5, fill = gcParams$weFill) + | ||
annotate("text", x = as.Date("2020-05-25"), | ||
y = yLoc * yMax, | ||
label = "Whitsun 2020") | ||
return(p) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.