Skip to content

Deprecate geom_errorbarh() #5961

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

Merged
merged 11 commits into from
Nov 11, 2024
1 change: 0 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -150,7 +150,6 @@ Collate:
'geom-density2d.R'
'geom-dotplot.R'
'geom-errorbar.R'
'geom-errorbarh.R'
'geom-freqpoly.R'
'geom-function.R'
'geom-hex.R'
44 changes: 44 additions & 0 deletions R/geom-errorbar.R
Original file line number Diff line number Diff line change
@@ -23,6 +23,35 @@ geom_errorbar <- function(mapping = NULL, data = NULL,
)
}

#' @export
#' @rdname geom_linerange
#' @note
#' `geom_errorbarh()` is `r lifecycle::badge("deprecated")`. Use
#' `geom_errorbar(orientation = "y")` instead.
geom_errorbarh <- function(mapping = NULL, data = NULL,
stat = "identity", position = "identity",
...,
orientation = "y",
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE) {
deprecate_soft0(
"3.5.2", "geom_errobarh()", "geom_errorbar(orientation = \"y\")",
id = "no-more-errorbarh"
)
geom_errorbar(
mapping = mapping,
data = data,
stat = stat,
position = position,
...,
orientation = orientation,
na.rm = na.rm,
show.legend = show.legend,
inherit.aes = inherit.aes
)
}

#' @rdname ggplot2-ggproto
#' @format NULL
#' @usage NULL
@@ -80,3 +109,18 @@ GeomErrorbar <- ggproto("GeomErrorbar", Geom,

rename_size = TRUE
)

#' @rdname ggplot2-ggproto
#' @format NULL
#' @usage NULL
#' @export
GeomErrorbarh <- ggproto(
"GeomErrorbarh", GeomErrorbar,
setup_params = function(data, params) {
deprecate_soft0(
"3.5.2", "geom_errobarh()", "geom_errorbar(orientation = \"y\")",
id = "no-more-errorbarh"
)
GeomLinerange$setup_params(data, params)
}
)
91 changes: 0 additions & 91 deletions R/geom-errorbarh.R

This file was deleted.

3 changes: 1 addition & 2 deletions R/geom-linerange.R
Original file line number Diff line number Diff line change
@@ -11,8 +11,7 @@
#' `geom_pointrange()`.
#' @seealso
#' [stat_summary()] for examples of these guys in use,
#' [geom_smooth()] for continuous analogue,
#' [geom_errorbarh()] for a horizontal error bar.
#' [geom_smooth()] for continuous analogue
#' @export
#' @inheritParams layer
#' @inheritParams geom_bar
147 changes: 0 additions & 147 deletions man/geom_errorbarh.Rd

This file was deleted.

20 changes: 18 additions & 2 deletions man/geom_linerange.Rd

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

35 changes: 17 additions & 18 deletions man/ggplot2-ggproto.Rd
2 changes: 1 addition & 1 deletion tests/testthat/test-function-args.R
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ test_that("geom_xxx and GeomXxx$draw arg defaults match", {
geom_fun_names,
c("geom_map", "geom_sf", "geom_smooth", "geom_column", "geom_area",
"geom_density", "annotation_custom", "annotation_map", "annotation_raster",
"annotation_id")
"annotation_id", "geom_errorbarh")
)

# For each geom_xxx function and the corresponding GeomXxx$draw and
16 changes: 16 additions & 0 deletions tests/testthat/test-geom-errorbar.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
test_that("geom_errorbarh throws deprecation messages", {

lifecycle::expect_deprecated(geom_errorbarh())

p <- ggplot(
data.frame(y = "A", min = 0, max = 10),
aes(y = y, xmin = min, xmax = max)
) +
layer(
geom = "errorbarh",
stat = "identity",
position = "identity"
)

lifecycle::expect_deprecated(ggplot_build(p))
})