Skip to content

Upkeep spring 2025 #6440

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand Down
7 changes: 4 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -76,7 +77,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)
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
YEAR: 2024
YEAR: 2025
COPYRIGHT HOLDER: ggplot2 core developer team
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion R/aes.R
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ NULL
#'
#' # Note that users of your wrapper can use their own functions in the
#' # quoted expressions and all will resolve as it should!
#' cut3 <- function(x) cut_number(x, 3)
#' cut3 <- \(x) cut_number(x, 3)
#' scatter_by(mtcars, cut3(disp), drat)
aes <- function(x, y, ...) {
xs <- arg_enquos("x")
Expand Down
4 changes: 2 additions & 2 deletions R/annotation-logticks.R
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 1 addition & 3 deletions R/geom-function.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,9 @@
#' 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)
Expand Down
2 changes: 1 addition & 1 deletion R/geom-histogram.R
Original file line number Diff line number Diff line change
Expand Up @@ -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 <- function(mapping = NULL, data = NULL,
stat = "bin", position = "stack",
...,
Expand Down
2 changes: 1 addition & 1 deletion R/geom-map.R
Original file line number Diff line number Diff line change
Expand Up @@ -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]])
#' })
Expand Down
2 changes: 1 addition & 1 deletion R/labeller.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion R/stat-summary-2d.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#' 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))
Expand Down
14 changes: 7 additions & 7 deletions R/utilities-tidy-eval.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
#'
#' ```
#' my_function <- function(data, var, ...) {
#' data %>%
#' group_by(...) %>%
#' data |>
#' group_by(...) |>
#' summarise(mean = mean({{ var }}))
#' }
#' ```
Expand All @@ -43,8 +43,8 @@
#' dots <- enquos(...)
#'
#' # Inject
#' data %>%
#' group_by(!!!dots) %>%
#' data |>
#' group_by(!!!dots) |>
#' summarise(mean = mean(!!var))
#' }
#' ```
Expand All @@ -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
Expand All @@ -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 }}))
#' }
#' ```
Expand All @@ -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))
#' }
#' ```
Expand Down
2 changes: 1 addition & 1 deletion man/aes.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/annotation_logticks.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions man/geom_function.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/geom_histogram.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/geom_map.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/ggplot2-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/labellers.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/stat_summary_2d.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions man/tidyeval.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/testthat/test-facet-.R
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ test_that("facet variables", {
test_that("facet gives clear error if ", {
df <- data_frame(x = 1)
expect_snapshot_error(print(ggplot(df, aes(x)) + facet_grid(x ~ x)))
expect_snapshot_error(print(ggplot(df, aes(x)) %>% facet_grid(. ~ x)))
expect_snapshot_error(print(ggplot(df, aes(x)) |> facet_grid(. ~ x)))
expect_snapshot_error(print(ggplot(df, aes(x)) + facet_grid(list(1, 2, 3))))
expect_snapshot_error(print(ggplot(df, aes(x)) + facet_grid(vars(x), "free")))
})
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-stat-bin.R
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ test_that("fuzzy breaks are used when cutting", {
p <- ggplot(df, aes(x)) +
geom_histogram(binwidth = 0.1, boundary = 0.1, closed = "left")

bins <- get_layer_data(p) %>% subset(count > 0) %>% .[1:5]
bins <- get_layer_data(p) |> subset(count > 0) |> head(5)
expect_equal(bins$count, c(1, 1, 1, 1))
})

Expand Down
16 changes: 8 additions & 8 deletions vignettes/articles/faq-annotation.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ Note that we expanded the y axis limit to get the numbers to fit on the plot.
```{r}
#| fig.alt: "A bar chart showing the number of cars for each of three types
#| of drive train. The count values are displayed on top of the bars as text."
mpg %>%
dplyr::count(drv) %>%
mpg |>
dplyr::count(drv) |>
ggplot(aes(x = drv, y = n)) +
geom_col() +
geom_text(aes(label = n), vjust = -0.5) +
Expand Down Expand Up @@ -184,7 +184,7 @@ ggplot(mpg, aes(x = class, fill = drv)) +
You can first calculate the counts for each segment with `dplyr::count()`, which will place these values in a column called `n`.

```{r}
mpg %>%
mpg |>
count(class, drv)
```

Expand All @@ -195,8 +195,8 @@ You can then pass this result directly to `ggplot()`, draw the segments with app
#| types of cars. The fill colour of the bars indicate the type of drive
#| train. In the middle of each filled part, the count value is displayed as
#| text."
mpg %>%
count(class, drv) %>%
mpg |>
count(class, drv) |>
ggplot(aes(x = class, fill = drv, y = n)) +
geom_col() +
geom_text(aes(label = n), size = 3, position = position_stack(vjust = 0.5))
Expand Down Expand Up @@ -226,9 +226,9 @@ One option is to calculate the proportions with `dplyr::count()` and then use `g
```{r}
#| fig.alt: "A bar chart showing the proportion of cars for each of three types
#| of drive train."
mpg %>%
dplyr::count(drv) %>%
mutate(prop = n / sum(n)) %>%
mpg |>
dplyr::count(drv) |>
mutate(prop = n / sum(n)) |>
ggplot(aes(x = drv, y = prop)) +
geom_col()
```
Expand Down
Loading