Skip to content

Commit e1cdee0

Browse files
authored
Merge pull request #6403 from tidyverse/rc/3.5.2
Release 3.5.2
2 parents 5b0ea0b + ec9e909 commit e1cdee0

Some content is hidden

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

57 files changed

+2921
-25856
lines changed

Diff for: DESCRIPTION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: ggplot2
2+
Version: 3.5.2.9000
23
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")),

Diff for: NAMESPACE

+15-12
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,6 @@ export(element_geom)
352352
export(element_grob)
353353
export(element_line)
354354
export(element_point)
355-
export(element_polygon)
356355
export(element_rect)
357356
export(element_render)
358357
export(element_text)
@@ -470,22 +469,26 @@ export(guide_transform)
470469
export(guides)
471470
export(has_flipped_aes)
472471
export(is.Coord)
473-
export(is.coord)
474472
export(is.facet)
475-
export(is.geom)
476473
export(is.ggplot)
477474
export(is.ggproto)
478-
export(is.guide)
479-
export(is.guides)
480-
export(is.layer)
481-
export(is.mapping)
482-
export(is.margin)
483-
export(is.position)
484-
export(is.scale)
485-
export(is.stat)
486475
export(is.theme)
487-
export(is.theme_element)
488476
export(is.waiver)
477+
export(is_coord)
478+
export(is_facet)
479+
export(is_geom)
480+
export(is_ggplot)
481+
export(is_ggproto)
482+
export(is_guide)
483+
export(is_guides)
484+
export(is_layer)
485+
export(is_mapping)
486+
export(is_margin)
487+
export(is_position)
488+
export(is_scale)
489+
export(is_stat)
490+
export(is_theme)
491+
export(is_theme_element)
489492
export(label_both)
490493
export(label_bquote)
491494
export(label_context)

Diff for: NEWS.md

+753-733
Large diffs are not rendered by default.

Diff for: R/aes.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ aes <- function(x, y, ...) {
111111

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

116116
# Wrap symbolic objects in quosures but pull out constants out of
117117
# quosures for backward-compatibility

Diff for: R/bin.R

+2-2
Original file line numberDiff line numberDiff line change
@@ -120,15 +120,15 @@ compute_bins <- function(x, scale = NULL, breaks = NULL, binwidth = NULL, bins =
120120
center = NULL, boundary = NULL,
121121
closed = c("right", "left")) {
122122

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

126126
if (!is.null(breaks)) {
127127
breaks <- allow_lambda(breaks)
128128
if (is.function(breaks)) {
129129
breaks <- breaks(x)
130130
}
131-
if (is.scale(scale) && !scale$is_discrete()) {
131+
if (is_scale(scale) && !scale$is_discrete()) {
132132
breaks <- scale$transform(breaks)
133133
}
134134
check_numeric(breaks)

Diff for: R/coord-.R

+3-4
Original file line numberDiff line numberDiff line change
@@ -225,17 +225,16 @@ Coord <- ggproto("Coord",
225225
}
226226
)
227227

228-
229228
#' @export
230229
#' @rdname is_tests
231-
is.coord <- function(x) inherits(x, "Coord")
230+
is_coord <- function(x) inherits(x, "Coord")
232231

233232
#' @export
234233
#' @rdname is_tests
235234
#' @usage is.Coord(x) # Deprecated
236235
is.Coord <- function(x) {
237-
deprecate_soft0("3.5.2", "is.Coord()", "is.coord()")
238-
is.coord(x)
236+
deprecate_soft0("3.5.2", "is.Coord()", "is_coord()")
237+
is_coord(x)
239238
}
240239

241240
# Renders an axis with the correct orientation or zeroGrob if no axis should be

Diff for: R/coord-cartesian-.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ view_scales_from_scale <- function(scale, coord_limits = NULL, expand = TRUE) {
165165
}
166166

167167
panel_guides_grob <- function(guides, position, theme, labels = NULL) {
168-
if (!is.guides(guides)) {
168+
if (!is_guides(guides)) {
169169
return(zeroGrob())
170170
}
171171
pair <- guides$get_position(position)

Diff for: R/facet-.R

+16-8
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ NULL
99
#' rendered.
1010
#'
1111
#' Extending facets can range from the simple modifications of current facets,
12-
#' to very laborious rewrites with a lot of [gtable()] manipulation.
13-
#' For some examples of both, please see the extension vignette.
12+
#' to very laborious rewrites with a lot of [`gtable()`][gtable::gtable()]
13+
#' manipulation. For some examples of both, please see the extension vignette.
1414
#'
1515
#' `Facet` subclasses, like other extendible ggproto classes, have a range
1616
#' of methods that can be modified. Some of these are required for all new
@@ -49,7 +49,7 @@ NULL
4949
#'
5050
#' - `setup_panel_params`: modifies the x and y ranges for each panel. This is
5151
#' used to allow the `Facet` to interact with the `panel_params`.
52-
#'
52+
#'
5353
#' - `init_scales`: Given a master scale for x and y, create panel
5454
#' specific scales for each panel defined in the layout. The default is to
5555
#' simply clone the master scale.
@@ -318,10 +318,6 @@ Facet <- ggproto("Facet", NULL,
318318
}
319319
)
320320

321-
#' @export
322-
#' @rdname is_tests
323-
is.facet <- function(x) inherits(x, "Facet")
324-
325321
# Helpers -----------------------------------------------------------------
326322

327323
#' Quote faceting variables
@@ -383,6 +379,18 @@ vars <- function(...) {
383379
quos(...)
384380
}
385381

382+
#' @export
383+
#' @rdname is_tests
384+
is_facet <- function(x) inherits(x, "Facet")
385+
386+
#' @export
387+
#' @rdname is_tests
388+
#' @usage is.facet(x) # Deprecated
389+
is.facet <- function(x) {
390+
deprecate_soft0("3.5.2", "is.facet()", "is_facet()")
391+
is_facet(x)
392+
}
393+
386394
#' Accessing a plot's facet strip labels
387395
#'
388396
#' This functions retrieves labels from facet strips with the labeller applied.
@@ -493,7 +501,7 @@ as_facets_list <- function(x) {
493501
}
494502

495503
check_vars <- function(x) {
496-
if (is.mapping(x)) {
504+
if (is_mapping(x)) {
497505
cli::cli_abort("Please use {.fn vars} to supply facet variables.")
498506
}
499507
# Native pipe have higher precedence than + so any type of gg object can be

Diff for: R/fortify.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ fortify.default <- function(model, data, ...) {
9494
"or an object coercible by {.fn fortify}, or a valid ",
9595
"{.cls data.frame}-like object coercible by {.fn as.data.frame}"
9696
)
97-
if (is.mapping(model)) {
97+
if (is_mapping(model)) {
9898
msg <- c(
9999
paste0(msg, ", not ", obj_type_friendly(model), "."),
100100
"i" = "Did you accidentally pass {.fn aes} to the {.arg data} argument?"

Diff for: R/geom-.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ Geom <- ggproto("Geom",
237237

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

242242
eval_from_theme <- function(aesthetics, theme, class = NULL) {
243243
themed <- is_themed_aes(aesthetics)

Diff for: R/geom-defaults.R

+3-3
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,13 @@ update_stat_defaults <- function(stat, new) {
9393
#'
9494
#' # Changed theme
9595
#' get_geom_defaults("point", theme(geom = element_geom(ink = "purple")))
96-
get_geom_defaults <- function(geom, theme = theme_get()) {
96+
get_geom_defaults <- function(geom, theme = get_theme()) {
9797
theme <- theme %||% list(geom = .default_geom_element)
9898

9999
if (is.function(geom)) {
100100
geom <- geom()
101101
}
102-
if (is.layer(geom)) {
102+
if (is_layer(geom)) {
103103
data <- data_frame0(.id = 1L)
104104
data <- geom$compute_geom_2(data = data, theme = theme)
105105
data$.id <- NULL
@@ -108,7 +108,7 @@ get_geom_defaults <- function(geom, theme = theme_get()) {
108108
if (is.character(geom)) {
109109
geom <- validate_subclass(geom, "Geom")
110110
}
111-
if (is.geom(geom)) {
111+
if (is_geom(geom)) {
112112
out <- geom$use_defaults(data = NULL, theme = theme)
113113
return(out)
114114
}

Diff for: R/geom-label.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ GeomLabel <- ggproto("GeomLabel", Geom,
8888
data <- coord$transform(data, panel_params)
8989
data$vjust <- compute_just(data$vjust, data$y, data$x, data$angle)
9090
data$hjust <- compute_just(data$hjust, data$x, data$y, data$angle)
91-
if (!is.margin("margin")) {
91+
if (!is_margin("margin")) {
9292
label.padding <- rep(label.padding, length.out = 4)
9393
}
9494

Diff for: R/ggproto.R

+16-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#' Create a new ggproto object
22
#'
3-
#' Construct a new object with `ggproto()`, test with `is.ggproto()`,
3+
#' Construct a new object with `ggproto()`, test with `is_ggproto()`,
44
#' and access parent methods/fields with `ggproto_parent()`.
55
#'
66
#' ggproto implements a protype based OO system which blurs the lines between
@@ -52,7 +52,7 @@
5252
#' self$x
5353
#' }
5454
#' )
55-
#' is.ggproto(Adder)
55+
#' is_ggproto(Adder)
5656
#'
5757
#' Adder$add(10)
5858
#' Adder$add(10)
@@ -88,7 +88,7 @@ ggproto <- function(`_class` = NULL, `_inherit` = NULL, ...) {
8888

8989
super <- find_super()
9090
if (!is.null(super)) {
91-
check_object(super, is.ggproto, "a {.cls ggproto} object", arg = "_inherit")
91+
check_object(super, is_ggproto, "a {.cls ggproto} object", arg = "_inherit")
9292
e$super <- find_super
9393
class(e) <- c(`_class`, class(super))
9494
} else {
@@ -98,17 +98,25 @@ ggproto <- function(`_class` = NULL, `_inherit` = NULL, ...) {
9898
e
9999
}
100100

101-
#' @export
102-
#' @rdname is_tests
103-
is.ggproto <- function(x) inherits(x, "ggproto")
104-
105101
#' @export
106102
#' @rdname ggproto
107103
#' @param parent,self Access parent class `parent` of object `self`.
108104
ggproto_parent <- function(parent, self) {
109105
structure(list(parent = parent, self = self), class = "ggproto_parent")
110106
}
111107

108+
#' @export
109+
#' @rdname is_tests
110+
is_ggproto <- function(x) inherits(x, "ggproto")
111+
112+
#' @export
113+
#' @rdname is_tests
114+
#' @usage is.ggproto(x) # Deprecated
115+
is.ggproto <- function(x) {
116+
deprecate_soft0("3.5.2", "is.ggproto()", "is_ggproto()")
117+
is_ggproto(x)
118+
}
119+
112120
fetch_ggproto <- function(x, name) {
113121
res <- NULL
114122

@@ -303,7 +311,7 @@ object_summaries <- function(x, exclude = NULL, flat = TRUE) {
303311
values <- vapply(obj_names, function(name) {
304312
obj <- x[[name]]
305313
if (is.function(obj)) "function"
306-
else if (is.ggproto(obj)) format(obj, flat = flat)
314+
else if (is_ggproto(obj)) format(obj, flat = flat)
307315
else if (is.environment(obj)) "environment"
308316
else if (is.null(obj)) "NULL"
309317
else if (is.atomic(obj)) trim(paste(as.character(obj), collapse = " "))

Diff for: R/guide-.R

+4-4
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ new_guide <- function(..., available_aes = "any", super) {
5050

5151
# Validate theme settings
5252
if (!is.null(params$theme)) {
53-
check_object(params$theme, is.theme, what = "a {.cls theme} object")
53+
check_object(params$theme, is_theme, what = "a {.cls theme} object")
5454
check_theme(params$theme, call = caller_env())
5555
params$direction <- params$direction %||% params$theme$legend.direction
5656
}
@@ -68,7 +68,7 @@ new_guide <- function(..., available_aes = "any", super) {
6868

6969
#' @export
7070
#' @rdname is_tests
71-
is.guide <- function(x) inherits(x, "Guide")
71+
is_guide <- function(x) inherits(x, "Guide")
7272

7373
#' @section Guides:
7474
#'
@@ -376,10 +376,10 @@ Guide <- ggproto(
376376
# Renders tickmarks
377377
build_ticks = function(key, elements, params, position = params$position,
378378
length = elements$ticks_length) {
379-
if (!is.theme_element(elements)) {
379+
if (!is_theme_element(elements)) {
380380
elements <- elements$ticks
381381
}
382-
if (!inherits(elements, "element_line")) {
382+
if (!is_theme_element(elements, "line")) {
383383
return(zeroGrob())
384384
}
385385

Diff for: R/guide-axis.R

+2-2
Original file line numberDiff line numberDiff line change
@@ -259,10 +259,10 @@ GuideAxis <- ggproto(
259259
override_elements = function(params, elements, theme) {
260260
elements$text <-
261261
label_angle_heuristic(elements$text, params$position, params$angle)
262-
if (inherits(elements$ticks, "element_blank")) {
262+
if (is_theme_element(elements$ticks, "blank")) {
263263
elements$major_length <- unit(0, "cm")
264264
}
265-
if (inherits(elements$minor, "element_blank") || isFALSE(params$minor.ticks)) {
265+
if (is_theme_element(elements$minor, "blank") || isFALSE(params$minor.ticks)) {
266266
elements$minor_length <- unit(0, "cm")
267267
}
268268
return(elements)

Diff for: R/guide-colorbar.R

-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ NULL
55
#'
66
#' Colour bar guide shows continuous colour scales mapped onto values.
77
#' Colour bar is available with `scale_fill` and `scale_colour`.
8-
#' For more information, see the inspiration for this function:
9-
#' \href{http://www.mathworks.com/help/techdoc/ref/colorbar.html}{Matlab's colorbar function}.
108
#'
119
#' Guides can be specified in each `scale_*` or in [guides()].
1210
#' `guide="legend"` in `scale_*` is syntactic sugar for

Diff for: R/guide-legend.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -810,7 +810,7 @@ deprecated_guide_args <- function(
810810

811811
# Set as theme
812812
theme <- compact(theme)
813-
if (!is.theme(theme)) {
813+
if (!is_theme(theme)) {
814814
theme <- inject(theme(!!!theme))
815815
}
816816
theme

Diff for: R/guides-.R

+3-3
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ guides <- function(...) {
109109

110110
#' @export
111111
#' @rdname is_tests
112-
is.guides <- function(x) inherits(x, "Guides")
112+
is_guides <- function(x) inherits(x, "Guides")
113113

114114
# Class -------------------------------------------------------------------
115115

@@ -140,7 +140,7 @@ Guides <- ggproto(
140140
if (is.null(guides)) {
141141
return(invisible())
142142
}
143-
if (is.guides(guides)) {
143+
if (is_guides(guides)) {
144144
guides <- guides$guides
145145
}
146146
self$guides <- defaults(guides, self$guides)
@@ -912,7 +912,7 @@ validate_guide <- function(guide) {
912912
guide <- fun()
913913
}
914914
}
915-
if (is.guide(guide)) {
915+
if (is_guide(guide)) {
916916
return(guide)
917917
}
918918
if (inherits(guide, "guide") && is.list(guide)) {

0 commit comments

Comments
 (0)