From 0b82046b3c8a707e084b64a075402b8ab35407b7 Mon Sep 17 00:00:00 2001 From: Hiroaki Yutani Date: Mon, 7 Dec 2020 21:36:36 +0900 Subject: [PATCH 1/2] Expose position arg on geom_hline() and geom_vline() --- NEWS.md | 3 +++ R/geom-hline.r | 3 ++- R/geom-vline.r | 3 ++- man/geom_abline.Rd | 5 +++++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index edb832d2c5..bd74d98cd6 100644 --- a/NEWS.md +++ b/NEWS.md @@ -24,6 +24,9 @@ * ggplot2 now requires R >= 3.3 (#4247). +* `geom_hline()` and `geom_vline()` now have `position` argument + (@yutannihilation, #4285). + # ggplot2 3.3.2 This is a small release focusing on fixing regressions introduced in 3.3.1. diff --git a/R/geom-hline.r b/R/geom-hline.r index d242f74b08..0ff2fa93cf 100644 --- a/R/geom-hline.r +++ b/R/geom-hline.r @@ -4,6 +4,7 @@ NULL #' @export #' @rdname geom_abline geom_hline <- function(mapping = NULL, data = NULL, + position = "identity", ..., yintercept, na.rm = FALSE, @@ -29,7 +30,7 @@ geom_hline <- function(mapping = NULL, data = NULL, mapping = mapping, stat = StatIdentity, geom = GeomHline, - position = PositionIdentity, + position = position, show.legend = show.legend, inherit.aes = FALSE, params = list( diff --git a/R/geom-vline.r b/R/geom-vline.r index 3c22e0b1c9..19ee191d63 100644 --- a/R/geom-vline.r +++ b/R/geom-vline.r @@ -4,6 +4,7 @@ NULL #' @export #' @rdname geom_abline geom_vline <- function(mapping = NULL, data = NULL, + position = "identity", ..., xintercept, na.rm = FALSE, @@ -29,7 +30,7 @@ geom_vline <- function(mapping = NULL, data = NULL, mapping = mapping, stat = StatIdentity, geom = GeomVline, - position = PositionIdentity, + position = position, show.legend = show.legend, inherit.aes = FALSE, params = list( diff --git a/man/geom_abline.Rd b/man/geom_abline.Rd index d018b98860..33214ef2a5 100644 --- a/man/geom_abline.Rd +++ b/man/geom_abline.Rd @@ -19,6 +19,7 @@ geom_abline( geom_hline( mapping = NULL, data = NULL, + position = "identity", ..., yintercept, na.rm = FALSE, @@ -28,6 +29,7 @@ geom_hline( geom_vline( mapping = NULL, data = NULL, + position = "identity", ..., xintercept, na.rm = FALSE, @@ -66,6 +68,9 @@ a warning. If \code{TRUE}, missing values are silently removed.} It can also be a named logical vector to finely select the aesthetics to display.} +\item{position}{Position adjustment, either as a string, or the result of +a call to a position adjustment function.} + \item{xintercept, yintercept, slope, intercept}{Parameters that control the position of the line. If these are set, \code{data}, \code{mapping} and \code{show.legend} are overridden.} From 3d9ca23538383e5e5cbfc78809a1efaa674b0df2 Mon Sep 17 00:00:00 2001 From: Hiroaki Yutani Date: Mon, 7 Dec 2020 21:44:12 +0900 Subject: [PATCH 2/2] Try clearing cache --- .github/workflows/R-CMD-check.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 9fd3500247..8563b81570 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -10,7 +10,7 @@ name: R-CMD-check # Increment this version when we want to clear cache env: - cache-version: v4 + cache-version: v5 jobs: R-CMD-check: