Skip to content

Commit f8d9825

Browse files
authored
Deprecate fatten (#6238)
* deprecate fatten * `fatten` isn't a formal argument to `geom_boxplot()` * document * add news bullet
1 parent 1b9ee73 commit f8d9825

File tree

6 files changed

+36
-10
lines changed

6 files changed

+36
-10
lines changed

NEWS.md

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

3+
* The `fatten` argument has been deprecated in `geom_boxplot()`,
4+
`geom_crossbar()` and `geom_pointrange()` (@teunbrand, #4881).
35
* Axis labels are now preserved better when using `coord_sf(expand = TRUE)` and
46
graticule lines are straight but do not meet the edge (@teunbrand, #2985).
57
* Attempt to boost detail in `coord_polar()` and `coord_radial()` near the

R/geom-boxplot.R

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,15 @@ GeomBoxplot <- ggproto("GeomBoxplot", Geom,
239239
extra_params = c("na.rm", "orientation", "outliers"),
240240

241241
setup_params = function(data, params) {
242+
if ("fatten" %in% names(params)) {
243+
deprecate_soft0(
244+
"3.6.0", "geom_boxplot(fatten)",
245+
"geom_boxplot(median.linewidth)"
246+
)
247+
} else {
248+
# For backward compatibility reasons
249+
params$fatten <- 2
250+
}
242251
params$flipped_aes <- has_flipped_aes(data, params)
243252
params
244253
},

R/geom-crossbar.R

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ geom_crossbar <- function(mapping = NULL, data = NULL,
1717
box.color = NULL,
1818
box.linetype = NULL,
1919
box.linewidth = NULL,
20-
fatten = 2.5,
20+
fatten = deprecated(),
2121
na.rm = FALSE,
2222
orientation = NA,
2323
show.legend = NA,
@@ -60,6 +60,15 @@ geom_crossbar <- function(mapping = NULL, data = NULL,
6060
#' @export
6161
GeomCrossbar <- ggproto("GeomCrossbar", Geom,
6262
setup_params = function(data, params) {
63+
if (lifecycle::is_present(params$fatten)) {
64+
deprecate_soft0(
65+
"3.6.0", "geom_crossbar(fatten)",
66+
"geom_crossbar(middle.linewidth)"
67+
)
68+
} else {
69+
# For backward compatibility reasons
70+
params$fatten <- 2.5
71+
}
6372
GeomErrorbar$setup_params(data, params)
6473
},
6574

R/geom-linerange.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
#' @eval rd_orientation()
77
#'
88
#' @eval rd_aesthetics("geom", "linerange", "Note that `geom_pointrange()` also understands `size` for the size of the points.")
9-
#' @param fatten A multiplicative factor used to increase the size of the
10-
#' middle bar in `geom_crossbar()` and the middle point in
11-
#' `geom_pointrange()`.
9+
#' @param fatten `r lifecycle::badge("deprecated")` A multiplicative factor
10+
#' used to increase the size of the middle bar in `geom_crossbar()` and the
11+
#' middle point in `geom_pointrange()`.
1212
#' @seealso
1313
#' [stat_summary()] for examples of these guys in use,
1414
#' [geom_smooth()] for continuous analogue

R/geom-pointrange.R

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
geom_pointrange <- function(mapping = NULL, data = NULL,
44
stat = "identity", position = "identity",
55
...,
6-
fatten = 4,
6+
fatten = deprecated(),
77
na.rm = FALSE,
88
orientation = NA,
99
show.legend = NA,
@@ -42,6 +42,12 @@ GeomPointrange <- ggproto("GeomPointrange", Geom,
4242
required_aes = c("x", "y", "ymin|xmin", "ymax|xmax"),
4343

4444
setup_params = function(data, params) {
45+
if (lifecycle::is_present(params$fatten)) {
46+
deprecate_soft0("3.6.0", "geom_pointrange(fatten)", I("the `size` aesthetic"))
47+
} else {
48+
# For backward compatibility reasons
49+
params$fatten <- 4
50+
}
4551
GeomLinerange$setup_params(data, params)
4652
},
4753

man/geom_linerange.Rd

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)