Skip to content

Commit 979d5eb

Browse files
committed
Get more in-your-face about deprecating size in favour of linewidth
1 parent b6190d6 commit 979d5eb

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

R/geom-.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ Geom <- ggproto("Geom",
126126
# Take care of subclasses setting the wrong default when inheriting from
127127
# a geom with rename_size = TRUE
128128
if (self$rename_size && is.null(default_aes$linewidth)) {
129-
deprecate_soft0("3.4.0", I("Using the `size` aesthetic in this geom"), I("`linewidth` in the `default_aes` field and elsewhere"))
129+
deprecate_warn0("3.4.0", I("Using the `size` aesthetic in this geom"), I("`linewidth` in the `default_aes` field and elsewhere"))
130130
default_aes$linewidth <- default_aes$size
131131
}
132132

@@ -279,7 +279,7 @@ check_aesthetics <- function(x, n) {
279279

280280
fix_linewidth <- function(data, name) {
281281
if (is.null(data$linewidth) && !is.null(data$size)) {
282-
deprecate_soft0("3.4.0", I(paste0("Using the `size` aesthetic with ", name)), I("the `linewidth` aesthetic"))
282+
deprecate_warn0("3.4.0", I(paste0("Using the `size` aesthetic with ", name)), I("the `linewidth` aesthetic"))
283283
data$linewidth <- data$size
284284
}
285285
data

R/layer.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ layer <- function(geom = NULL, stat = NULL,
156156
if (geom$rename_size && "size" %in% extra_param && !"linewidth" %in% mapped_aesthetics(mapping)) {
157157
aes_params <- c(aes_params, params["size"])
158158
extra_param <- setdiff(extra_param, "size")
159-
deprecate_soft0("3.4.0", I("Using `size` aesthetic for lines"), I("`linewidth`"), user_env = user_env)
159+
deprecate_warn0("3.4.0", I("Using `size` aesthetic for lines"), I("`linewidth`"), user_env = user_env)
160160
}
161161
if (check.param && length(extra_param) > 0) {
162162
cli::cli_warn("Ignoring unknown parameters: {.arg {extra_param}}", call = call_env)
@@ -169,7 +169,7 @@ layer <- function(geom = NULL, stat = NULL,
169169
# Take care of size->linewidth aes renaming
170170
if (geom$rename_size && "size" %in% extra_aes && !"linewidth" %in% mapped_aesthetics(mapping)) {
171171
extra_aes <- setdiff(extra_aes, "size")
172-
deprecate_soft0("3.4.0", I("Using `size` aesthetic for lines"), I("`linewidth`"), user_env = user_env)
172+
deprecate_warn0("3.4.0", I("Using `size` aesthetic for lines"), I("`linewidth`"), user_env = user_env)
173173
}
174174
if (check.aes && length(extra_aes) > 0) {
175175
cli::cli_warn("Ignoring unknown aesthetics: {.field {extra_aes}}", call = call_env)
@@ -273,7 +273,7 @@ Layer <- ggproto("Layer", NULL,
273273
!"linewidth" %in% names(self$computed_mapping) &&
274274
"linewidth" %in% self$geom$aesthetics()) {
275275
self$computed_mapping$size <- plot$mapping$size
276-
deprecate_soft0("3.4.0", I("Using `size` aesthetic for lines"), I("`linewidth`"))
276+
deprecate_warn0("3.4.0", I("Using `size` aesthetic for lines"), I("`linewidth`"))
277277
}
278278
# defaults() strips class, but it needs to be preserved for now
279279
class(self$computed_mapping) <- "uneval"

R/theme-elements.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ element_rect <- function(fill = NULL, colour = NULL, linewidth = NULL,
9494
linetype = NULL, color = NULL, inherit.blank = FALSE, size = deprecated()) {
9595

9696
if (lifecycle::is_present(size)) {
97-
deprecate_soft0("3.4.0", "element_rect(size)", "element_rect(linewidth)")
97+
deprecate_warn0("3.4.0", "element_rect(size)", "element_rect(linewidth)")
9898
linewidth <- size
9999
}
100100

@@ -115,7 +115,7 @@ element_line <- function(colour = NULL, linewidth = NULL, linetype = NULL,
115115
inherit.blank = FALSE, size = deprecated()) {
116116

117117
if (lifecycle::is_present(size)) {
118-
deprecate_soft0("3.4.0", "element_line(size)", "element_line(linewidth)")
118+
deprecate_warn0("3.4.0", "element_line(size)", "element_line(linewidth)")
119119
linewidth <- size
120120
}
121121

@@ -307,7 +307,7 @@ element_grob.element_rect <- function(element, x = 0.5, y = 0.5,
307307
fill = NULL, colour = NULL, linewidth = NULL, linetype = NULL, ..., size = deprecated()) {
308308

309309
if (lifecycle::is_present(size)) {
310-
deprecate_soft0("3.4.0", "element_grob.element_rect(size)", "element_grob.element_rect(linewidth)")
310+
deprecate_warn0("3.4.0", "element_grob.element_rect(size)", "element_grob.element_rect(linewidth)")
311311
linewidth <- size
312312
}
313313

@@ -357,7 +357,7 @@ element_grob.element_line <- function(element, x = 0:1, y = 0:1,
357357
default.units = "npc", id.lengths = NULL, ..., size = deprecated()) {
358358

359359
if (lifecycle::is_present(size)) {
360-
deprecate_soft0("3.4.0", "element_grob.element_line(size)", "element_grob.element_line(linewidth)")
360+
deprecate_warn0("3.4.0", "element_grob.element_line(size)", "element_grob.element_line(linewidth)")
361361
linewidth <- size
362362
}
363363

0 commit comments

Comments
 (0)