Skip to content

Clear merge debris #6416

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

Closed
wants to merge 36 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
70c3dab
Increment version number to 3.5.1
thomasp85 Apr 22, 2024
3e585a8
update cran comments
thomasp85 Apr 22, 2024
8fa3974
fix wrong automatic version bump
thomasp85 Apr 22, 2024
4b67b19
remove tests for ragg/svglite
teunbrand Mar 31, 2025
7960366
Forward compatibility: cherry-pick accessors (#6387)
teunbrand Apr 3, 2025
836d820
Forward compatibility: `is_*()` functions (#6388)
teunbrand Apr 3, 2025
bb2c405
Forward compatibility: fix mistakes (#6394)
teunbrand Apr 3, 2025
2663bb1
Fix deprecation calls
thomasp85 Apr 7, 2025
19f2ed6
Prep tests for next svglite release
thomasp85 Apr 7, 2025
be1b49f
rename is_element -> is_theme_element
thomasp85 Apr 7, 2025
4ed6abe
Add back deleted functions
thomasp85 Apr 8, 2025
ff44403
run revdepcheck
thomasp85 Apr 8, 2025
92032f2
update news
thomasp85 Apr 8, 2025
3255f65
fix urls
thomasp85 Apr 8, 2025
35f02b9
better forward compat for svglite
thomasp85 Apr 8, 2025
ceb5a37
Fix links
thomasp85 Apr 8, 2025
78100d3
correctly ref new is_ggproto() in docs
thomasp85 Apr 8, 2025
2271567
update cran comments
thomasp85 Apr 8, 2025
8b27990
Increment version number to 3.5.2
thomasp85 Apr 8, 2025
0e7c028
Fix feedback from CRAN
thomasp85 Apr 9, 2025
99e9b7e
Increment version number to 3.5.2.9000
thomasp85 Apr 9, 2025
2ff77b1
Resolve merge conflict with RC branch (#6415)
teunbrand Apr 10, 2025
ec9e909
resolve merge conflict
teunbrand Apr 10, 2025
e1cdee0
Merge pull request #6403 from tidyverse/rc/3.5.2
teunbrand Apr 10, 2025
039aca7
move 3.5.2 news behind dev news
teunbrand Apr 10, 2025
2a3875c
rename `is.waiver()` -> `is_waiver()` for consistency
teunbrand Apr 10, 2025
587b87c
more consistently use new test functions
teunbrand Apr 10, 2025
884b0b0
include new elements in `is_theme_element(type)`
teunbrand Apr 10, 2025
ba76efc
replace `is.zero()` with `is_zero()`
teunbrand Apr 10, 2025
8f72633
replace `is.rel()` with `is_rel()`
teunbrand Apr 10, 2025
7658827
replace `is.formula()` with `rlang::is_formula()`
teunbrand Apr 10, 2025
fcd9c4b
replace `is.discrete()` with `is_discrete()`
teunbrand Apr 10, 2025
c8f0ae6
replace `is.derived()` with `is_derived()`
teunbrand Apr 10, 2025
928b605
replace `is.sec_axis()` with `is_sec_axis()`
teunbrand Apr 10, 2025
d471a11
fix doc issues
teunbrand Apr 10, 2025
95be32b
fix dumb mistake
teunbrand Apr 10, 2025
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
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: ggplot2
Version: 3.5.2.9000
Title: Create Elegant Data Visualisations Using the Grammar of Graphics
Version: 3.5.1.9000
Authors@R: c(
person("Hadley", "Wickham", , "[email protected]", role = "aut",
comment = c(ORCID = "0000-0003-4757-117X")),
Expand Down
28 changes: 16 additions & 12 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -470,22 +470,26 @@ export(guide_transform)
export(guides)
export(has_flipped_aes)
export(is.Coord)
export(is.coord)
export(is.facet)
export(is.geom)
export(is.ggplot)
export(is.ggproto)
export(is.guide)
export(is.guides)
export(is.layer)
export(is.mapping)
export(is.margin)
export(is.position)
export(is.scale)
export(is.stat)
export(is.theme)
export(is.theme_element)
export(is.waiver)
export(is_coord)
export(is_facet)
export(is_geom)
export(is_ggplot)
export(is_ggproto)
export(is_guide)
export(is_guides)
export(is_layer)
export(is_mapping)
export(is_margin)
export(is_position)
export(is_scale)
export(is_stat)
export(is_theme)
export(is_theme_element)
export(is_waiver)
export(label_both)
export(label_bquote)
export(label_context)
Expand Down
1,486 changes: 752 additions & 734 deletions NEWS.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions R/aes.R
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ aes <- function(x, y, ...) {

#' @export
#' @rdname is_tests
is.mapping <- function(x) inherits(x, "uneval")
is_mapping <- function(x) inherits(x, "uneval")

# Wrap symbolic objects in quosures but pull out constants out of
# quosures for backward-compatibility
Expand Down Expand Up @@ -302,7 +302,7 @@ aes_ <- function(x, y, ...) {
caller_env <- parent.frame()

as_quosure_aes <- function(x) {
if (is.formula(x) && length(x) == 2) {
if (is_formula(x) && length(x) == 2) {
as_quosure(x)
} else if (is.null(x) || is.call(x) || is.name(x) || is.atomic(x)) {
new_aesthetic(x, caller_env)
Expand Down
20 changes: 10 additions & 10 deletions R/axis-secondary.R
Original file line number Diff line number Diff line change
Expand Up @@ -124,19 +124,19 @@ dup_axis <- function(transform = identity, name = derive(), breaks = derive(),
sec_axis(transform, trans = trans, name, breaks, labels, guide)
}

is.sec_axis <- function(x) {
is_sec_axis <- function(x) {
inherits(x, "AxisSecondary")
}

set_sec_axis <- function(sec.axis, scale) {
if (!is.waiver(sec.axis)) {
if (!is_waiver(sec.axis)) {
if (scale$is_discrete()) {
if (!identical(.subset2(sec.axis, "trans"), identity)) {
cli::cli_abort("Discrete secondary axes must have the {.fn identity} transformation.")
}
}
if (is.formula(sec.axis)) sec.axis <- sec_axis(sec.axis)
if (!is.sec_axis(sec.axis)) {
if (is_formula(sec.axis)) sec.axis <- sec_axis(sec.axis)
if (!is_sec_axis(sec.axis)) {
cli::cli_abort("Secondary axes must be specified using {.fn sec_axis}.")
}
scale$secondary.axis <- sec.axis
Expand All @@ -150,7 +150,7 @@ set_sec_axis <- function(sec.axis, scale) {
derive <- function() {
structure(list(), class = "derived")
}
is.derived <- function(x) {
is_derived <- function(x) {
inherits(x, "derived")
}
#' @rdname ggplot2-ggproto
Expand Down Expand Up @@ -182,9 +182,9 @@ AxisSecondary <- ggproto("AxisSecondary", NULL,
if (!is.function(transform)) {
cli::cli_abort("Transformation for secondary axes must be a function.")
}
if (is.derived(self$name) && !is.waiver(scale$name)) self$name <- scale$name
if (is.derived(self$breaks)) self$breaks <- scale$breaks
if (is.waiver(self$breaks)) {
if (is_derived(self$name) && !is_waiver(scale$name)) self$name <- scale$name
if (is_derived(self$breaks)) self$breaks <- scale$breaks
if (is_waiver(self$breaks)) {
if (scale$is_discrete()) {
self$breaks <- setNames(nm = scale$get_breaks())
} else {
Expand All @@ -197,8 +197,8 @@ AxisSecondary <- ggproto("AxisSecondary", NULL,
}
}
}
if (is.derived(self$labels)) self$labels <- scale$labels
if (is.derived(self$guide)) self$guide <- scale$guide
if (is_derived(self$labels)) self$labels <- scale$labels
if (is_derived(self$guide)) self$guide <- scale$guide
},

transform_range = function(self, range) {
Expand Down
4 changes: 2 additions & 2 deletions R/bin.R
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,15 @@ compute_bins <- function(x, scale = NULL, breaks = NULL, binwidth = NULL, bins =
center = NULL, boundary = NULL,
closed = c("right", "left")) {

range <- if (is.scale(scale)) scale$dimension() else range(x)
range <- if (is_scale(scale)) scale$dimension() else range(x)
check_length(range, 2L)

if (!is.null(breaks)) {
breaks <- allow_lambda(breaks)
if (is.function(breaks)) {
breaks <- breaks(x)
}
if (is.scale(scale) && !scale$is_discrete()) {
if (is_scale(scale) && !scale$is_discrete()) {
breaks <- scale$transform(breaks)
}
check_numeric(breaks)
Expand Down
7 changes: 3 additions & 4 deletions R/coord-.R
Original file line number Diff line number Diff line change
Expand Up @@ -225,17 +225,16 @@ Coord <- ggproto("Coord",
}
)


#' @export
#' @rdname is_tests
is.coord <- function(x) inherits(x, "Coord")
is_coord <- function(x) inherits(x, "Coord")

#' @export
#' @rdname is_tests
#' @usage is.Coord(x) # Deprecated
is.Coord <- function(x) {
deprecate_soft0("3.5.2", "is.Coord()", "is.coord()")
is.coord(x)
deprecate_soft0("3.5.2", "is.Coord()", "is_coord()")
is_coord(x)
}

# Renders an axis with the correct orientation or zeroGrob if no axis should be
Expand Down
2 changes: 1 addition & 1 deletion R/coord-cartesian-.R
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ view_scales_from_scale <- function(scale, coord_limits = NULL, expand = TRUE) {
}

panel_guides_grob <- function(guides, position, theme, labels = NULL) {
if (!is.guides(guides)) {
if (!is_guides(guides)) {
return(zeroGrob())
}
pair <- guides$get_position(position)
Expand Down
14 changes: 7 additions & 7 deletions R/coord-sf.R
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ CoordSf <- ggproto("CoordSf", CoordCartesian,
x_breaks <- graticule$degree[graticule$type == "E"]
if (is.null(scale_x$labels)) {
x_labels <- rep(NA, length(x_breaks))
} else if (is.waiver(scale_x$labels)) {
} else if (is_waiver(scale_x$labels)) {
x_labels <- graticule$degree_label[graticule$type == "E"]
needs_autoparsing[graticule$type == "E"] <- TRUE
} else {
Expand All @@ -141,7 +141,7 @@ CoordSf <- ggproto("CoordSf", CoordCartesian,
y_breaks <- graticule$degree[graticule$type == "N"]
if (is.null(scale_y$labels)) {
y_labels <- rep(NA, length(y_breaks))
} else if (is.waiver(scale_y$labels)) {
} else if (is_waiver(scale_y$labels)) {
y_labels <- graticule$degree_label[graticule$type == "N"]
needs_autoparsing[graticule$type == "N"] <- TRUE
} else {
Expand Down Expand Up @@ -334,7 +334,7 @@ CoordSf <- ggproto("CoordSf", CoordCartesian,

# we don't draw the graticules if the major panel grid is
# turned off
if (inherits(el, "element_blank")) {
if (is_theme_element(el, "blank")) {
grobs <- list(element_render(theme, "panel.background"))
} else {
line_gp <- gg_par(
Expand Down Expand Up @@ -553,7 +553,7 @@ coord_sf <- function(xlim = NULL, ylim = NULL, expand = TRUE,
ndiscr = 100, default = FALSE, clip = "on",
reverse = "none") {

if (is.waiver(label_graticule) && is.waiver(label_axes)) {
if (is_waiver(label_graticule) && is_waiver(label_axes)) {
# if both `label_graticule` and `label_axes` are set to waive then we
# use the default of labels on the left and at the bottom
label_graticule <- ""
Expand Down Expand Up @@ -640,13 +640,13 @@ sf_breaks <- function(scale_x, scale_y, bbox, crs) {
bbox[is.na(bbox)] <- c(-180, -90, 180, 90)[is.na(bbox)]
}

if (!(is.waiver(scale_x$breaks) && is.null(scale_x$n.breaks))) {
if (!(is_waiver(scale_x$breaks) && is.null(scale_x$n.breaks))) {
x_breaks <- scale_x$get_breaks(limits = bbox[c(1, 3)])
finite <- is.finite(x_breaks)
x_breaks <- if (any(finite)) x_breaks[finite] else NULL
}

if (!(is.waiver(scale_y$breaks) && is.null(scale_y$n.breaks))) {
if (!(is_waiver(scale_y$breaks) && is.null(scale_y$n.breaks))) {
y_breaks <- scale_y$get_breaks(limits = bbox[c(2, 4)])
finite <- is.finite(y_breaks)
y_breaks <- if (any(finite)) y_breaks[finite] else NULL
Expand Down Expand Up @@ -769,7 +769,7 @@ view_scales_from_graticule <- function(graticule, scale, aesthetic,
if (scale$position != position) {
# Try to use secondary axis' guide
guide <- scale$secondary.axis$guide %||% waiver()
if (is.derived(guide)) {
if (is_derived(guide)) {
guide <- scale$guide
}
} else {
Expand Down
24 changes: 16 additions & 8 deletions R/facet-.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ NULL
#' rendered.
#'
#' Extending facets can range from the simple modifications of current facets,
#' to very laborious rewrites with a lot of [gtable()] manipulation.
#' For some examples of both, please see the extension vignette.
#' to very laborious rewrites with a lot of [`gtable()`][gtable::gtable()]
#' manipulation. For some examples of both, please see the extension vignette.
#'
#' `Facet` subclasses, like other extendible ggproto classes, have a range
#' of methods that can be modified. Some of these are required for all new
Expand Down Expand Up @@ -49,7 +49,7 @@ NULL
#'
#' - `setup_panel_params`: modifies the x and y ranges for each panel. This is
#' used to allow the `Facet` to interact with the `panel_params`.
#'
#'
#' - `init_scales`: Given a master scale for x and y, create panel
#' specific scales for each panel defined in the layout. The default is to
#' simply clone the master scale.
Expand Down Expand Up @@ -318,10 +318,6 @@ Facet <- ggproto("Facet", NULL,
}
)

#' @export
#' @rdname is_tests
is.facet <- function(x) inherits(x, "Facet")

# Helpers -----------------------------------------------------------------

#' Quote faceting variables
Expand Down Expand Up @@ -383,6 +379,18 @@ vars <- function(...) {
quos(...)
}

#' @export
#' @rdname is_tests
is_facet <- function(x) inherits(x, "Facet")

#' @export
#' @rdname is_tests
#' @usage is.facet(x) # Deprecated
is.facet <- function(x) {
deprecate_soft0("3.5.2", "is.facet()", "is_facet()")
is_facet(x)
}

#' Accessing a plot's facet strip labels
#'
#' This functions retrieves labels from facet strips with the labeller applied.
Expand Down Expand Up @@ -493,7 +501,7 @@ as_facets_list <- function(x) {
}

check_vars <- function(x) {
if (is.mapping(x)) {
if (is_mapping(x)) {
cli::cli_abort("Please use {.fn vars} to supply facet variables.")
}
# Native pipe have higher precedence than + so any type of gg object can be
Expand Down
2 changes: 1 addition & 1 deletion R/facet-grid-.R
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ ulevels <- function(x, na.last = TRUE) {

table_has_grob <- function(table, pattern) {
grobs <- table$grobs[grep(pattern, table$layout$name)]
!all(vapply(grobs, is.zero, logical(1)))
!all(vapply(grobs, is_zero, logical(1)))
}

seam_table <- function(table, grobs = NULL, side, shift = 1, name, z = 1,
Expand Down
4 changes: 2 additions & 2 deletions R/facet-null.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ FacetNull <- ggproto("FacetNull", Facet,
layout_null()
},
map_data = function(data, layout, params) {
# Need the is.waiver check for special case where no data, but aesthetics
# Need the is_waiver check for special case where no data, but aesthetics
# are mapped to vectors
if (is.waiver(data))
if (is_waiver(data))
return(data_frame0(PANEL = factor()))

if (empty(data))
Expand Down
10 changes: 5 additions & 5 deletions R/facet-wrap.R
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ FacetWrap <- ggproto("FacetWrap", Facet,
if (length(empty_bottom) > 0) {
x_axes <- original$x$bottom[matched[empty_bottom]]
clash["bottom"] <- strip == "bottom" && !inside && !free$x &&
!all(vapply(x_axes, is.zero, logical(1)))
!all(vapply(x_axes, is_zero, logical(1)))
if (!clash["bottom"]) {
bottom[empty_bottom] <- x_axes
}
Expand All @@ -336,7 +336,7 @@ FacetWrap <- ggproto("FacetWrap", Facet,
if (length(empty_top) > 0) {
x_axes <- original$x$top[matched[empty_top]]
clash["top"] <- strip == "top" && !inside && !free$x &&
!all(vapply(x_axes, is.zero, logical(1)))
!all(vapply(x_axes, is_zero, logical(1)))
if (!clash["top"]) {
top[empty_top] <- x_axes
}
Expand All @@ -345,7 +345,7 @@ FacetWrap <- ggproto("FacetWrap", Facet,
if (length(empty_right) > 0) {
y_axes <- original$y$right[matched[empty_right]]
clash["right"] <- strip == "right" && !inside && !free$y &&
!all(vapply(y_axes, is.zero, logical(1)))
!all(vapply(y_axes, is_zero, logical(1)))
if (!clash["right"]) {
right[empty_right] <- y_axes
}
Expand All @@ -354,7 +354,7 @@ FacetWrap <- ggproto("FacetWrap", Facet,
if (length(empty_left) > 0) {
y_axes <- original$y$left[matched[empty_left]]
clash["left"] <- strip == "left" && !inside && !free$y &&
!all(vapply(y_axes, is.zero, logical(1)))
!all(vapply(y_axes, is_zero, logical(1)))
if (!clash["left"]) {
left[empty_left] <- y_axes
}
Expand Down Expand Up @@ -410,7 +410,7 @@ FacetWrap <- ggproto("FacetWrap", Facet,

if (!inside) {
axes <- grepl(paste0("axis-", pos), table$layout$name)
has_axes <- !vapply(table$grobs[axes], is.zero, logical(1))
has_axes <- !vapply(table$grobs[axes], is_zero, logical(1))
has_axes <- split(has_axes, table$layout[[pos]][axes])
has_axes <- vapply(has_axes, sum, numeric(1)) > 0
padding <- rep(padding, length(has_axes))
Expand Down
2 changes: 1 addition & 1 deletion R/fortify.R
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ fortify.default <- function(model, data, ...) {
"or an object coercible by {.fn fortify}, or a valid ",
"{.cls data.frame}-like object coercible by {.fn as.data.frame}"
)
if (is.mapping(model)) {
if (is_mapping(model)) {
msg <- c(
paste0(msg, ", not ", obj_type_friendly(model), "."),
"i" = "Did you accidentally pass {.fn aes} to the {.arg data} argument?"
Expand Down
2 changes: 1 addition & 1 deletion R/geom-.R
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ Geom <- ggproto("Geom",

#' @export
#' @rdname is_tests
is.geom <- function(x) inherits(x, "Geom")
is_geom <- function(x) inherits(x, "Geom")

eval_from_theme <- function(aesthetics, theme, class = NULL) {
themed <- is_themed_aes(aesthetics)
Expand Down
6 changes: 3 additions & 3 deletions R/geom-defaults.R
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,13 @@ update_stat_defaults <- function(stat, new) {
#'
#' # Changed theme
#' get_geom_defaults("point", theme(geom = element_geom(ink = "purple")))
get_geom_defaults <- function(geom, theme = theme_get()) {
get_geom_defaults <- function(geom, theme = get_theme()) {
theme <- theme %||% list(geom = .default_geom_element)

if (is.function(geom)) {
geom <- geom()
}
if (is.layer(geom)) {
if (is_layer(geom)) {
data <- data_frame0(.id = 1L)
data <- geom$compute_geom_2(data = data, theme = theme)
data$.id <- NULL
Expand All @@ -108,7 +108,7 @@ get_geom_defaults <- function(geom, theme = theme_get()) {
if (is.character(geom)) {
geom <- validate_subclass(geom, "Geom")
}
if (is.geom(geom)) {
if (is_geom(geom)) {
out <- geom$use_defaults(data = NULL, theme = theme)
return(out)
}
Expand Down
Loading
Loading