Skip to content

Commit 79d37dd

Browse files
committed
Merge branch 'main' into asis_note
2 parents 098f39e + b29b831 commit 79d37dd

File tree

178 files changed

+2571
-1598
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

178 files changed

+2571
-1598
lines changed

.github/workflows/R-CMD-check.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
cache-version: 3
6464
extra-packages: >
6565
any::rcmdcheck,
66-
Hmisc=?ignore-before-r=4.1.0,
66+
Hmisc=?ignore-before-r=4.2.0,
6767
quantreg=?ignore-before-r=4.3.0
6868
needs: check
6969

DESCRIPTION

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: ggplot2
2-
Version: 3.5.1.9000
32
Title: Create Elegant Data Visualisations Using the Grammar of Graphics
3+
Version: 3.5.1.9000
44
Authors@R: c(
55
person("Hadley", "Wickham", , "[email protected]", role = "aut",
66
comment = c(ORCID = "0000-0003-4757-117X")),
@@ -30,7 +30,7 @@ License: MIT + file LICENSE
3030
URL: https://ggplot2.tidyverse.org, https://github.com/tidyverse/ggplot2
3131
BugReports: https://github.com/tidyverse/ggplot2/issues
3232
Depends:
33-
R (>= 3.5)
33+
R (>= 4.0)
3434
Imports:
3535
cli,
3636
grDevices,
@@ -75,6 +75,7 @@ VignetteBuilder:
7575
knitr
7676
Config/Needs/website: ggtext, tidyr, forcats, tidyverse/tidytemplate
7777
Config/testthat/edition: 3
78+
Config/usethis/last-upkeep: 2024-10-24
7879
Encoding: UTF-8
7980
LazyData: true
8081
Roxygen: list(markdown = TRUE)

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MIT License
22

3-
Copyright (c) 2020 ggplot2 authors
3+
Copyright (c) 2024 ggplot2 core developer team
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# ggplot2 (development version)
22

3+
* (internal) Using `after_scale()` in the `Geom*$default_aes()` field is now
4+
evaluated in the context of data (@teunbrand, #6135)
35
* Fixed bug where binned scales wouldn't simultaneously accept transformations
46
and function-limits (@teunbrand, #6144).
57
* Fixed bug where the `ggplot2::`-prefix did not work with `stage()`
@@ -186,6 +188,7 @@
186188
* The ellipsis argument is now checked in `fortify()`, `get_alt_text()`,
187189
`labs()` and several guides (@teunbrand, #3196).
188190
* `stat_summary_bin()` no longer ignores `width` parameter (@teunbrand, #4647).
191+
* Added `keep.zeroes` argument to `stat_bin()` (@teunbrand, #3449)
189192

190193
# ggplot2 3.5.1
191194

@@ -232,6 +235,7 @@ documentation updates.
232235
* `annotate()` now warns about `stat` or `position` arguments (@teunbrand, #5151)
233236
* `guide_coloursteps(even.steps = FALSE)` now works with discrete data that has
234237
been formatted by `cut()` (@teunbrand, #3877).
238+
* `ggsave()` now offers to install svglite if needed (@eliocamp, #6166).
235239

236240
# ggplot2 3.5.0
237241

R/bin.R

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,7 @@ bin_breaks <- function(breaks, closed = c("right", "left")) {
5454

5555
bin_breaks_width <- function(x_range, width = NULL, center = NULL,
5656
boundary = NULL, closed = c("right", "left")) {
57-
if (length(x_range) != 2) {
58-
cli::cli_abort("{.arg x_range} must have two elements.")
59-
}
57+
check_length(x_range, 2L)
6058

6159
# binwidth seems to be the argument name supplied to width. (stat-bin and stat-bindot)
6260
check_number_decimal(width, min = 0, allow_infinite = FALSE, arg = "binwidth")
@@ -106,9 +104,7 @@ bin_breaks_width <- function(x_range, width = NULL, center = NULL,
106104

107105
bin_breaks_bins <- function(x_range, bins = 30, center = NULL,
108106
boundary = NULL, closed = c("right", "left")) {
109-
if (length(x_range) != 2) {
110-
cli::cli_abort("{.arg x_range} must have two elements.")
111-
}
107+
check_length(x_range, 2L)
112108

113109
check_number_whole(bins, min = 1)
114110
if (zero_range(x_range)) {

R/coord-.R

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -281,14 +281,6 @@ check_coord_limits <- function(
281281
if (is.null(limits)) {
282282
return(invisible(NULL))
283283
}
284-
if (!obj_is_vector(limits) || length(limits) != 2) {
285-
what <- "{.obj_type_friendly {limits}}"
286-
if (is.vector(limits)) {
287-
what <- paste0(what, " of length {length(limits)}")
288-
}
289-
cli::cli_abort(
290-
paste0("{.arg {arg}} must be a vector of length 2, not ", what, "."),
291-
call = call
292-
)
293-
}
284+
check_object(limits, is_vector, "a vector", arg = arg, call = call)
285+
check_length(limits, 2L, arg = arg, call = call)
294286
}

R/geom-.R

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,13 @@ Geom <- ggproto("Geom",
136136
themed_defaults <- eval_from_theme(default_aes, theme)
137137
default_aes[names(themed_defaults)] <- themed_defaults
138138

139+
# Mark staged/scaled defaults as modifier (#6135)
140+
delayed <- is_scaled_aes(default_aes) | is_staged_aes(default_aes)
141+
if (any(delayed)) {
142+
modifiers <- defaults(modifiers, default_aes[delayed])
143+
default_aes <- default_aes[!delayed]
144+
}
145+
139146
missing_eval <- lapply(default_aes, eval_tidy)
140147
# Needed for geoms with defaults set to NULL (e.g. GeomSf)
141148
missing_eval <- compact(missing_eval)

R/geom-map.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ NULL
2222
#' # how `geom_map()` works. It requires two data frames:
2323
#' # One contains the coordinates of each polygon (`positions`), and is
2424
#' # provided via the `map` argument. The other contains the
25-
#' # other the values associated with each polygon (`values`). An id
25+
#' # values associated with each polygon (`values`). An id
2626
#' # variable links the two together.
2727
#'
2828
#' ids <- factor(c("1.1", "2.1", "1.2", "2.2", "1.3", "2.3"))

R/geom-sf.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,8 @@ GeomSf <- ggproto("GeomSf", Geom,
238238
linewidth[is_point] <- stroke[is_point]
239239

240240
gp <- gpar(
241-
col = colour, fill = fill, fontsize = font_size, lwd = linewidth,
241+
col = colour, fill = fill, fontsize = font_size,
242+
lwd = linewidth, lty = data$linetype,
242243
lineend = lineend, linejoin = linejoin, linemitre = linemitre
243244
)
244245

R/import-standalone-obj-type.R

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,27 @@
11
# Standalone file: do not edit by hand
2-
# Source: <https://github.com/r-lib/rlang/blob/main/R/standalone-obj-type.R>
2+
# Source: https://github.com/r-lib/rlang/blob/HEAD/R/standalone-obj-type.R
3+
# Generated by: usethis::use_standalone("r-lib/rlang", "obj-type")
34
# ----------------------------------------------------------------------
45
#
56
# ---
67
# repo: r-lib/rlang
78
# file: standalone-obj-type.R
8-
# last-updated: 2022-10-04
9+
# last-updated: 2024-02-14
910
# license: https://unlicense.org
1011
# imports: rlang (>= 1.1.0)
1112
# ---
1213
#
1314
# ## Changelog
1415
#
16+
# 2024-02-14:
17+
# - `obj_type_friendly()` now works for S7 objects.
18+
#
19+
# 2023-05-01:
20+
# - `obj_type_friendly()` now only displays the first class of S3 objects.
21+
#
22+
# 2023-03-30:
23+
# - `stop_input_type()` now handles `I()` input literally in `arg`.
24+
#
1525
# 2022-10-04:
1626
# - `obj_type_friendly(value = TRUE)` now shows numeric scalars
1727
# literally.
@@ -65,7 +75,7 @@ obj_type_friendly <- function(x, value = TRUE) {
6575
if (inherits(x, "quosure")) {
6676
type <- "quosure"
6777
} else {
68-
type <- paste(class(x), collapse = "/")
78+
type <- class(x)[[1L]]
6979
}
7080
return(sprintf("a <%s> object", type))
7181
}
@@ -261,19 +271,19 @@ vec_type_friendly <- function(x, length = FALSE) {
261271
#' Return OO type
262272
#' @param x Any R object.
263273
#' @return One of `"bare"` (for non-OO objects), `"S3"`, `"S4"`,
264-
#' `"R6"`, or `"R7"`.
274+
#' `"R6"`, or `"S7"`.
265275
#' @noRd
266276
obj_type_oo <- function(x) {
267277
if (!is.object(x)) {
268278
return("bare")
269279
}
270280

271-
class <- inherits(x, c("R6", "R7_object"), which = TRUE)
281+
class <- inherits(x, c("R6", "S7_object"), which = TRUE)
272282

273283
if (class[[1]]) {
274284
"R6"
275285
} else if (class[[2]]) {
276-
"R7"
286+
"S7"
277287
} else if (isS4(x)) {
278288
"S4"
279289
} else {
@@ -315,10 +325,15 @@ stop_input_type <- function(x,
315325
if (length(what)) {
316326
what <- oxford_comma(what)
317327
}
328+
if (inherits(arg, "AsIs")) {
329+
format_arg <- identity
330+
} else {
331+
format_arg <- cli$format_arg
332+
}
318333

319334
message <- sprintf(
320335
"%s must be %s, not %s.",
321-
cli$format_arg(arg),
336+
format_arg(arg),
322337
what,
323338
obj_type_friendly(x, value = show_value)
324339
)

0 commit comments

Comments
 (0)