From d0519a033cb76a3cd5dc32590f7f4143b29a6b32 Mon Sep 17 00:00:00 2001 From: Teun van den Brand Date: Thu, 30 Jan 2025 17:01:41 +0100 Subject: [PATCH 1/3] remove test --- tests/testthat/test-graphics.R | 7 ------- 1 file changed, 7 deletions(-) diff --git a/tests/testthat/test-graphics.R b/tests/testthat/test-graphics.R index 6480d7d8..9c60cff6 100644 --- a/tests/testthat/test-graphics.R +++ b/tests/testthat/test-graphics.R @@ -267,11 +267,4 @@ test_that("gg_arma() plots", { ggplot2::layer_data(p, 4)$PANEL, factor(c(rep_along(ar_roots, 1), rep_along(ma_roots, 2))) ) - - p_built <- ggplot2::ggplot_build(p) - - expect_equivalent( - p_built$plot$labels[c("x", "y")], - list(x = "Re(1/root)", y = "Im(1/root)") - ) }) From 5e30828784f280b291218bba525a04a0a7a17db5 Mon Sep 17 00:00:00 2001 From: Teun van den Brand Date: Thu, 30 Jan 2025 17:01:50 +0100 Subject: [PATCH 2/3] target adding labs --- tests/testthat/test-graphics.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/test-graphics.R b/tests/testthat/test-graphics.R index 9c60cff6..1c31a190 100644 --- a/tests/testthat/test-graphics.R +++ b/tests/testthat/test-graphics.R @@ -189,7 +189,7 @@ test_that("gg_tsdisplay() plots", { list(x = "index", y = "value") ) - p <- p + ggplot2::labs(x = "x", y = "y", title = "title") + p[[1]] <- p[[1]] + ggplot2::labs(x = "x", y = "y", title = "title") p_built <- ggplot2::ggplot_build(p[[1]]) From ef4b3d548bb119540bb412dd2a68969c9db77ac9 Mon Sep 17 00:00:00 2001 From: Mitchell O'Hara-Wild Date: Fri, 31 Jan 2025 18:20:23 +1100 Subject: [PATCH 3/3] Prioritise `+.gg_tsensemble` method over `+.gg` to resolve Ops conflict --- DESCRIPTION | 2 +- NAMESPACE | 1 + R/graphics.R | 8 ++++++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 9bcc154d..eef3da4a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -49,7 +49,7 @@ License: GPL-3 URL: http://feasts.tidyverts.org/, https://github.com/tidyverts/feasts/ BugReports: https://github.com/tidyverts/feasts/issues Encoding: UTF-8 -RoxygenNote: 7.3.2 +RoxygenNote: 7.3.2.9000 Roxygen: list(markdown = TRUE, roclets=c('rd', 'collate', 'namespace')) Language: en-GB RdMacros: lifecycle diff --git a/NAMESPACE b/NAMESPACE index de499163..d70a2e43 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -2,6 +2,7 @@ S3method("+",gg_tsensemble) S3method(autoplot,tbl_cf) +S3method(chooseOpsMethod,gg_tsensemble) S3method(components,classical_decomposition) S3method(components,feasts_x13arimaseats) S3method(components,stl_decomposition) diff --git a/R/graphics.R b/R/graphics.R index 299eac86..998d4960 100644 --- a/R/graphics.R +++ b/R/graphics.R @@ -728,11 +728,15 @@ gg_tsresiduals <- function(data, type = "innovation", ...){ } #' @export -`+.gg_tsensemble` <- function(e1, e2){ - e1[[1]] <- e1[[1]] + e2 +`+.gg_tsensemble` <- function(e1, e2) { + e1[[1L]] <- e1[[1L]] + e2 e1 } +#' @export +chooseOpsMethod.gg_tsensemble <- function(x, y, mx, my, cl, reverse) TRUE + + #' @export print.gg_tsensemble <- function(x, ...){ x <- lapply(x, ggplot2::ggplotGrob)