Skip to content

Commit be01f49

Browse files
committed
resolve merge conflict
Merge branch 'main' into discrete_labels_from_break_names # Conflicts: # R/scale-.R
2 parents f38cf14 + 6606390 commit be01f49

File tree

228 files changed

+3427
-1982
lines changed

Some content is hidden

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

228 files changed

+3427
-1982
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: 4 additions & 4 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,15 +30,14 @@ 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,
3737
grid,
3838
gtable (>= 0.1.1),
3939
isoband,
4040
lifecycle (> 1.0.1),
41-
MASS,
4241
rlang (>= 1.1.0),
4342
scales (>= 1.3.0),
4443
stats,
@@ -53,6 +52,7 @@ Suggests:
5352
knitr,
5453
mapproj,
5554
maps,
55+
MASS,
5656
mgcv,
5757
multcomp,
5858
munsell,
@@ -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)
@@ -150,7 +151,6 @@ Collate:
150151
'geom-density2d.R'
151152
'geom-dotplot.R'
152153
'geom-errorbar.R'
153-
'geom-errorbarh.R'
154154
'geom-freqpoly.R'
155155
'geom-function.R'
156156
'geom-hex.R'

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

NAMESPACE

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,6 @@ export(guides)
461461
export(has_flipped_aes)
462462
export(is.Coord)
463463
export(is.coord)
464-
export(is.element)
465464
export(is.facet)
466465
export(is.geom)
467466
export(is.ggplot)
@@ -475,6 +474,8 @@ export(is.position)
475474
export(is.scale)
476475
export(is.stat)
477476
export(is.theme)
477+
export(is.theme_element)
478+
export(is.waiver)
478479
export(label_both)
479480
export(label_bquote)
480481
export(label_context)

NEWS.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,20 @@
22

33
* When discrete breaks have names, they'll be used as labels by default
44
(@teunbrand, #6147).
5+
* The helper function `is.waiver()` is now exported to help extensions to work
6+
with `waiver()` objects (@arcresu, #6173).
7+
* Date(time) scales now throw appropriate errors when `date_breaks`,
8+
`date_minor_breaks` or `date_labels` are not strings (@RodDalBen, #5880)
9+
* `geom_errorbarh()` is deprecated in favour of
10+
`geom_errorbar(orientation = "y")` (@teunbrand, #5961).
11+
* `geom_contour()` should be able to recognise a rotated grid of points
12+
(@teunbrand, #4320)
13+
* `geom_boxplot()` gains additional arguments to style the colour, linetype and
14+
linewidths of the box, whiskers, median line and staples (@teunbrand, #5126)
15+
* (internal) Using `after_scale()` in the `Geom*$default_aes()` field is now
16+
evaluated in the context of data (@teunbrand, #6135)
17+
* Fixed bug where binned scales wouldn't simultaneously accept transformations
18+
and function-limits (@teunbrand, #6144).
519
* Fixed bug where the `ggplot2::`-prefix did not work with `stage()`
620
(@teunbrand, #6104).
721
* New `get_labs()` function for retrieving completed plot labels
@@ -186,6 +200,8 @@
186200
* The ellipsis argument is now checked in `fortify()`, `get_alt_text()`,
187201
`labs()` and several guides (@teunbrand, #3196).
188202
* `stat_summary_bin()` no longer ignores `width` parameter (@teunbrand, #4647).
203+
* Added `keep.zeroes` argument to `stat_bin()` (@teunbrand, #3449)
204+
* `coord_sf()` no longer errors when dealing with empty graticules (@teunbrand, #6052)
189205

190206
# ggplot2 3.5.1
191207

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

236253
# ggplot2 3.5.0
237254

R/axis-secondary.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ is.sec_axis <- function(x) {
129129
}
130130

131131
set_sec_axis <- function(sec.axis, scale) {
132-
if (!is.waive(sec.axis)) {
132+
if (!is.waiver(sec.axis)) {
133133
if (scale$is_discrete()) {
134134
if (!identical(.subset2(sec.axis, "trans"), identity)) {
135135
cli::cli_abort("Discrete secondary axes must have the {.fn identity} transformation.")
@@ -182,9 +182,9 @@ AxisSecondary <- ggproto("AxisSecondary", NULL,
182182
if (!is.function(transform)) {
183183
cli::cli_abort("Transformation for secondary axes must be a function.")
184184
}
185-
if (is.derived(self$name) && !is.waive(scale$name)) self$name <- scale$name
185+
if (is.derived(self$name) && !is.waiver(scale$name)) self$name <- scale$name
186186
if (is.derived(self$breaks)) self$breaks <- scale$breaks
187-
if (is.waive(self$breaks)) {
187+
if (is.waiver(self$breaks)) {
188188
if (scale$is_discrete()) {
189189
self$breaks <- setNames(nm = scale$get_breaks())
190190
} else {

R/backports.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,6 @@ on_load({
6767
as.mask <- grid::as.mask
6868
}
6969
if ("linearGradient" %in% getNamespaceExports("grid")) {
70-
linearGradient <- grid::linearGradient()
70+
linearGradient <- grid::linearGradient
7171
}
7272
})

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/coord-sf.R

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ CoordSf <- ggproto("CoordSf", CoordCartesian,
108108
x_breaks <- graticule$degree[graticule$type == "E"]
109109
if (is.null(scale_x$labels)) {
110110
x_labels <- rep(NA, length(x_breaks))
111-
} else if (is.waive(scale_x$labels)) {
111+
} else if (is.waiver(scale_x$labels)) {
112112
x_labels <- graticule$degree_label[graticule$type == "E"]
113113
needs_autoparsing[graticule$type == "E"] <- TRUE
114114
} else {
@@ -133,7 +133,7 @@ CoordSf <- ggproto("CoordSf", CoordCartesian,
133133
y_breaks <- graticule$degree[graticule$type == "N"]
134134
if (is.null(scale_y$labels)) {
135135
y_labels <- rep(NA, length(y_breaks))
136-
} else if (is.waive(scale_y$labels)) {
136+
} else if (is.waiver(scale_y$labels)) {
137137
y_labels <- graticule$degree_label[graticule$type == "N"]
138138
needs_autoparsing[graticule$type == "N"] <- TRUE
139139
} else {
@@ -534,7 +534,7 @@ coord_sf <- function(xlim = NULL, ylim = NULL, expand = TRUE,
534534
label_axes = waiver(), lims_method = "cross",
535535
ndiscr = 100, default = FALSE, clip = "on") {
536536

537-
if (is.waive(label_graticule) && is.waive(label_axes)) {
537+
if (is.waiver(label_graticule) && is.waiver(label_axes)) {
538538
# if both `label_graticule` and `label_axes` are set to waive then we
539539
# use the default of labels on the left and at the bottom
540540
label_graticule <- ""
@@ -620,13 +620,13 @@ sf_breaks <- function(scale_x, scale_y, bbox, crs) {
620620
bbox[is.na(bbox)] <- c(-180, -90, 180, 90)[is.na(bbox)]
621621
}
622622

623-
if (!(is.waive(scale_x$breaks) && is.null(scale_x$n.breaks))) {
623+
if (!(is.waiver(scale_x$breaks) && is.null(scale_x$n.breaks))) {
624624
x_breaks <- scale_x$get_breaks(limits = bbox[c(1, 3)])
625625
finite <- is.finite(x_breaks)
626626
x_breaks <- if (any(finite)) x_breaks[finite] else NULL
627627
}
628628

629-
if (!(is.waive(scale_y$breaks) && is.null(scale_y$n.breaks))) {
629+
if (!(is.waiver(scale_y$breaks) && is.null(scale_y$n.breaks))) {
630630
y_breaks <- scale_y$get_breaks(limits = bbox[c(2, 4)])
631631
finite <- is.finite(y_breaks)
632632
y_breaks <- if (any(finite)) y_breaks[finite] else NULL
@@ -657,6 +657,9 @@ sf_breaks <- function(scale_x, scale_y, bbox, crs) {
657657
#' @keywords internal
658658
view_scales_from_graticule <- function(graticule, scale, aesthetic,
659659
label, label_graticule, bbox) {
660+
if (empty(graticule)) {
661+
return(ggproto(NULL, ViewScale))
662+
}
660663

661664
# Setup position specific parameters
662665
# Note that top/bottom doesn't necessarily mean to label the meridians and

0 commit comments

Comments
 (0)