diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index 988226098e..eb448e9c28 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -35,14 +35,16 @@ jobs: clean = FALSE, install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package") ) + print(cov) covr::to_cobertura(cov) shell: Rscript {0} - - uses: codecov/codecov-action@v4 + - uses: codecov/codecov-action@v5 with: - fail_ci_if_error: ${{ github.event_name != 'pull_request' && true || false }} - file: ./cobertura.xml - plugin: noop + # Fail if error if not on PR, or if on PR and token is given + fail_ci_if_error: ${{ github.event_name != 'pull_request' || secrets.CODECOV_TOKEN }} + files: ./cobertura.xml + plugins: noop disable_search: true token: ${{ secrets.CODECOV_TOKEN }} diff --git a/DESCRIPTION b/DESCRIPTION index 6b64da806e..be9f013c4a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -20,7 +20,8 @@ Authors@R: c( comment = c(ORCID = "0000-0002-9415-4582")), person("Teun", "van den Brand", role = "aut", comment = c(ORCID = "0000-0002-9335-7468")), - person("Posit, PBC", role = c("cph", "fnd")) + person("Posit, PBC", role = c("cph", "fnd"), + comment = c(ROR = "03wc8by49")) ) Description: A system for 'declaratively' creating graphics, based on "The Grammar of Graphics". You provide the data, tell 'ggplot2' how to map @@ -30,7 +31,7 @@ License: MIT + file LICENSE URL: https://ggplot2.tidyverse.org, https://github.com/tidyverse/ggplot2 BugReports: https://github.com/tidyverse/ggplot2/issues Depends: - R (>= 4.0) + R (>= 4.1) Imports: cli, grDevices, @@ -77,7 +78,7 @@ VignetteBuilder: knitr Config/Needs/website: ggtext, tidyr, forcats, tidyverse/tidytemplate Config/testthat/edition: 3 -Config/usethis/last-upkeep: 2024-10-24 +Config/usethis/last-upkeep: 2025-04-23 Encoding: UTF-8 LazyData: true Roxygen: list(markdown = TRUE) diff --git a/LICENSE b/LICENSE index f4515a155b..b0469670b3 100644 --- a/LICENSE +++ b/LICENSE @@ -1,2 +1,2 @@ -YEAR: 2024 +YEAR: 2025 COPYRIGHT HOLDER: ggplot2 core developer team diff --git a/LICENSE.md b/LICENSE.md index ce73598634..7c6a53d75e 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ # MIT License -Copyright (c) 2024 ggplot2 core developer team +Copyright (c) 2025 ggplot2 core developer team Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/R/annotation-logticks.R b/R/annotation-logticks.R index 97caad7495..7fa69aa843 100644 --- a/R/annotation-logticks.R +++ b/R/annotation-logticks.R @@ -43,11 +43,11 @@ #' a <- ggplot(msleep, aes(bodywt, brainwt)) + #' geom_point(na.rm = TRUE) + #' scale_x_log10( -#' breaks = scales::trans_breaks("log10", function(x) 10^x), +#' breaks = scales::trans_breaks("log10", \(x) 10^x), #' labels = scales::trans_format("log10", scales::math_format(10^.x)) #' ) + #' scale_y_log10( -#' breaks = scales::trans_breaks("log10", function(x) 10^x), +#' breaks = scales::trans_breaks("log10", \(x) 10^x), #' labels = scales::trans_format("log10", scales::math_format(10^.x)) #' ) + #' theme_bw() diff --git a/R/geom-function.R b/R/geom-function.R index 4b9c09fa0e..ba595da7c3 100644 --- a/R/geom-function.R +++ b/R/geom-function.R @@ -65,11 +65,9 @@ GeomFunction <- ggproto("GeomFunction", GeomPath, #' geom_function(aes(colour = "t, df = 1"), fun = dt, args = list(df = 1)) #' #' # Using a custom anonymous function -#' base + geom_function(fun = function(x) 0.5 * exp(-abs(x))) +#' base + geom_function(fun = \(x) 0.5 * exp(-abs(x))) #' # or using lambda syntax: #' # base + geom_function(fun = ~ 0.5 * exp(-abs(.x))) -#' # or in R4.1.0 and above: -#' # base + geom_function(fun = \(x) 0.5 * exp(-abs(x))) #' # or using a custom named function: #' # f <- function(x) 0.5 * exp(-abs(x)) #' # base + geom_function(fun = f) diff --git a/R/geom-histogram.R b/R/geom-histogram.R index 8272d818f9..a922a54dd7 100644 --- a/R/geom-histogram.R +++ b/R/geom-histogram.R @@ -132,7 +132,7 @@ #' # different ranges because the function will be called once per facet #' ggplot(economics_long, aes(value)) + #' facet_wrap(~variable, scales = 'free_x') + -#' geom_histogram(binwidth = function(x) 2 * IQR(x) / (length(x)^(1/3))) +#' geom_histogram(binwidth = \(x) 2 * IQR(x) / (length(x)^(1/3))) geom_histogram <- make_constructor( GeomBar, stat = "bin", position = "stack", # Passed to bin stat: diff --git a/R/geom-map.R b/R/geom-map.R index 8d9e415c2f..026bb94e6b 100644 --- a/R/geom-map.R +++ b/R/geom-map.R @@ -55,7 +55,7 @@ NULL #' #' crimes <- data.frame(state = tolower(rownames(USArrests)), USArrests) #' -#' # Equivalent to crimes %>% tidyr::pivot_longer(Murder:Rape) +#' # Equivalent to crimes |> tidyr::pivot_longer(Murder:Rape) #' vars <- lapply(names(crimes)[-1], function(j) { #' data.frame(state = crimes$state, variable = j, value = crimes[[j]]) #' }) diff --git a/R/labeller.R b/R/labeller.R index 6d3c1b10ae..ad57a4f283 100644 --- a/R/labeller.R +++ b/R/labeller.R @@ -85,7 +85,7 @@ #' p + facet_grid(. ~ cyl2, labeller = label_parsed) #' #' # Include optional argument in label function -#' p + facet_grid(. ~ cyl, labeller = function(x) label_both(x, sep = "=")) +#' p + facet_grid(. ~ cyl, labeller = \(x) label_both(x, sep = "=")) #' } #' @name labellers NULL diff --git a/R/stat-summary-2d.R b/R/stat-summary-2d.R index 16319db269..84e79c63d9 100644 --- a/R/stat-summary-2d.R +++ b/R/stat-summary-2d.R @@ -99,7 +99,7 @@ StatSummary2d <- ggproto( #' d + stat_summary_2d() #' #' # Specifying function -#' d + stat_summary_2d(fun = function(x) sum(x^2)) +#' d + stat_summary_2d(fun = \(x) sum(x^2)) #' d + stat_summary_2d(fun = ~ sum(.x^2)) #' d + stat_summary_2d(fun = var) #' d + stat_summary_2d(fun = "quantile", fun.args = list(probs = 0.1)) diff --git a/R/utilities-tidy-eval.R b/R/utilities-tidy-eval.R index eac1085256..41895f4fcb 100644 --- a/R/utilities-tidy-eval.R +++ b/R/utilities-tidy-eval.R @@ -23,8 +23,8 @@ #' #' ``` #' my_function <- function(data, var, ...) { -#' data %>% -#' group_by(...) %>% +#' data |> +#' group_by(...) |> #' summarise(mean = mean({{ var }})) #' } #' ``` @@ -43,8 +43,8 @@ #' dots <- enquos(...) #' #' # Inject -#' data %>% -#' group_by(!!!dots) %>% +#' data |> +#' group_by(!!!dots) |> #' summarise(mean = mean(!!var)) #' } #' ``` @@ -60,7 +60,7 @@ #' #' ``` #' my_var <- "disp" -#' mtcars %>% summarise(mean = mean(.data[[my_var]])) +#' mtcars |> summarise(mean = mean(.data[[my_var]])) #' ``` #' #' * Another tidy eval operator is `:=`. It makes it possible to use @@ -72,7 +72,7 @@ #' my_function <- function(data, var, suffix = "foo") { #' # Use `{{` to tunnel function arguments and the usual glue #' # operator `{` to interpolate plain strings. -#' data %>% +#' data |> #' summarise("{{ var }}_mean_{suffix}" := mean({{ var }})) #' } #' ``` @@ -87,7 +87,7 @@ #' my_function <- function(data, var, suffix = "foo") { #' var <- enquo(var) #' prefix <- as_label(var) -#' data %>% +#' data |> #' summarise("{prefix}_mean_{suffix}" := mean(!!var)) #' } #' ``` diff --git a/man/annotation_logticks.Rd b/man/annotation_logticks.Rd index b37a54560d..aae0172de3 100644 --- a/man/annotation_logticks.Rd +++ b/man/annotation_logticks.Rd @@ -73,11 +73,11 @@ These tick marks probably make sense only for base 10. a <- ggplot(msleep, aes(bodywt, brainwt)) + geom_point(na.rm = TRUE) + scale_x_log10( - breaks = scales::trans_breaks("log10", function(x) 10^x), + breaks = scales::trans_breaks("log10", \(x) 10^x), labels = scales::trans_format("log10", scales::math_format(10^.x)) ) + scale_y_log10( - breaks = scales::trans_breaks("log10", function(x) 10^x), + breaks = scales::trans_breaks("log10", \(x) 10^x), labels = scales::trans_format("log10", scales::math_format(10^.x)) ) + theme_bw() diff --git a/man/geom_function.Rd b/man/geom_function.Rd index f9bf5cb0b2..7198e9e5ca 100644 --- a/man/geom_function.Rd +++ b/man/geom_function.Rd @@ -197,11 +197,9 @@ base + geom_function(aes(colour = "t, df = 1"), fun = dt, args = list(df = 1)) # Using a custom anonymous function -base + geom_function(fun = function(x) 0.5 * exp(-abs(x))) +base + geom_function(fun = \(x) 0.5 * exp(-abs(x))) # or using lambda syntax: # base + geom_function(fun = ~ 0.5 * exp(-abs(.x))) -# or in R4.1.0 and above: -# base + geom_function(fun = \(x) 0.5 * exp(-abs(x))) # or using a custom named function: # f <- function(x) 0.5 * exp(-abs(x)) # base + geom_function(fun = f) diff --git a/man/geom_histogram.Rd b/man/geom_histogram.Rd index 686ebc98c9..b298a092a2 100644 --- a/man/geom_histogram.Rd +++ b/man/geom_histogram.Rd @@ -337,7 +337,7 @@ m + # different ranges because the function will be called once per facet ggplot(economics_long, aes(value)) + facet_wrap(~variable, scales = 'free_x') + - geom_histogram(binwidth = function(x) 2 * IQR(x) / (length(x)^(1/3))) + geom_histogram(binwidth = \(x) 2 * IQR(x) / (length(x)^(1/3))) } \seealso{ \code{\link[=stat_count]{stat_count()}}, which counts the number of cases at each x diff --git a/man/geom_map.Rd b/man/geom_map.Rd index 22f9598833..f287efe53e 100644 --- a/man/geom_map.Rd +++ b/man/geom_map.Rd @@ -143,7 +143,7 @@ if (require(maps)) { crimes <- data.frame(state = tolower(rownames(USArrests)), USArrests) - # Equivalent to crimes \%>\% tidyr::pivot_longer(Murder:Rape) + # Equivalent to crimes |> tidyr::pivot_longer(Murder:Rape) vars <- lapply(names(crimes)[-1], function(j) { data.frame(state = crimes$state, variable = j, value = crimes[[j]]) }) diff --git a/man/ggplot2-package.Rd b/man/ggplot2-package.Rd index 23ed67a2a5..4a57a87766 100644 --- a/man/ggplot2-package.Rd +++ b/man/ggplot2-package.Rd @@ -37,7 +37,7 @@ Authors: Other contributors: \itemize{ - \item Posit, PBC [copyright holder, funder] + \item Posit, PBC (03wc8by49) [copyright holder, funder] } } diff --git a/man/labellers.Rd b/man/labellers.Rd index 09f160bf40..70ac8bf712 100644 --- a/man/labellers.Rd +++ b/man/labellers.Rd @@ -110,7 +110,7 @@ p + facet_grid(. ~ cyl2) p + facet_grid(. ~ cyl2, labeller = label_parsed) # Include optional argument in label function -p + facet_grid(. ~ cyl, labeller = function(x) label_both(x, sep = "=")) +p + facet_grid(. ~ cyl, labeller = \(x) label_both(x, sep = "=")) } } \seealso{ diff --git a/man/stat_summary_2d.Rd b/man/stat_summary_2d.Rd index d0a6f4da31..41517514cc 100644 --- a/man/stat_summary_2d.Rd +++ b/man/stat_summary_2d.Rd @@ -217,7 +217,7 @@ d <- ggplot(diamonds, aes(carat, depth, z = price)) d + stat_summary_2d() # Specifying function -d + stat_summary_2d(fun = function(x) sum(x^2)) +d + stat_summary_2d(fun = \(x) sum(x^2)) d + stat_summary_2d(fun = ~ sum(.x^2)) d + stat_summary_2d(fun = var) d + stat_summary_2d(fun = "quantile", fun.args = list(probs = 0.1)) diff --git a/man/tidyeval.Rd b/man/tidyeval.Rd index 41fed21ef8..36266b4153 100644 --- a/man/tidyeval.Rd +++ b/man/tidyeval.Rd @@ -35,8 +35,8 @@ passed from function arguments inside other tidy eval functions. arguments contained in dots, use \code{...} in the normal way. \if{html}{\out{