Skip to content
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

Deprecate fatten #6238

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# ggplot2 (development version)

* The `fatten` argument has been deprecated in `geom_boxplot()`,
`geom_crossbar()` and `geom_pointrange()` (@teunbrand, #4881).
* `guide_*()` can now accept two inside legend theme elements:
`legend.position.inside` and `legend.justification.inside`, allowing inside
legends to be placed at different positions. Only inside legends with the same
Expand Down
9 changes: 9 additions & 0 deletions R/geom-boxplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,15 @@ GeomBoxplot <- ggproto("GeomBoxplot", Geom,
extra_params = c("na.rm", "width", "orientation", "outliers"),

setup_params = function(data, params) {
if ("fatten" %in% names(params)) {
deprecate_soft0(
"3.6.0", "geom_boxplot(fatten)",
"geom_boxplot(median.linewidth)"
)
} else {
# For backward compatibility reasons
params$fatten <- 2
}
params$flipped_aes <- has_flipped_aes(data, params)
params
},
Expand Down
11 changes: 10 additions & 1 deletion R/geom-crossbar.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ geom_crossbar <- function(mapping = NULL, data = NULL,
box.color = NULL,
box.linetype = NULL,
box.linewidth = NULL,
fatten = 2.5,
fatten = deprecated(),
na.rm = FALSE,
orientation = NA,
show.legend = NA,
Expand Down Expand Up @@ -60,6 +60,15 @@ geom_crossbar <- function(mapping = NULL, data = NULL,
#' @export
GeomCrossbar <- ggproto("GeomCrossbar", Geom,
setup_params = function(data, params) {
if (lifecycle::is_present(params$fatten)) {
deprecate_soft0(
"3.6.0", "geom_crossbar(fatten)",
"geom_crossbar(middle.linewidth)"
)
} else {
# For backward compatibility reasons
params$fatten <- 2.5
}
GeomErrorbar$setup_params(data, params)
},

Expand Down
6 changes: 3 additions & 3 deletions R/geom-linerange.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
#' @eval rd_orientation()
#'
#' @eval rd_aesthetics("geom", "linerange", "Note that `geom_pointrange()` also understands `size` for the size of the points.")
#' @param fatten A multiplicative factor used to increase the size of the
#' middle bar in `geom_crossbar()` and the middle point in
#' `geom_pointrange()`.
#' @param fatten `r lifecycle::badge("deprecated")` A multiplicative factor
#' used to increase the size of the middle bar in `geom_crossbar()` and the
#' middle point in `geom_pointrange()`.
#' @seealso
#' [stat_summary()] for examples of these guys in use,
#' [geom_smooth()] for continuous analogue
Expand Down
8 changes: 7 additions & 1 deletion R/geom-pointrange.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
geom_pointrange <- function(mapping = NULL, data = NULL,
stat = "identity", position = "identity",
...,
fatten = 4,
fatten = deprecated(),
na.rm = FALSE,
orientation = NA,
show.legend = NA,
Expand Down Expand Up @@ -42,6 +42,12 @@ GeomPointrange <- ggproto("GeomPointrange", Geom,
required_aes = c("x", "y", "ymin|xmin", "ymax|xmax"),

setup_params = function(data, params) {
if (lifecycle::is_present(params$fatten)) {
deprecate_soft0("3.6.0", "geom_pointrange(fatten)", I("the `size` aesthetic"))
} else {
# For backward compatibility reasons
params$fatten <- 4
}
GeomLinerange$setup_params(data, params)
},

Expand Down
10 changes: 5 additions & 5 deletions man/geom_linerange.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading