Skip to content

Commit 029055c

Browse files
Rename outline.type option "legacy" to "full" (#3715)
1 parent 4e25869 commit 029055c

File tree

6 files changed

+14
-20
lines changed

6 files changed

+14
-20
lines changed

NEWS.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ fail.
2727
(`NA`) rather than drawing a white one. (@annennenne, #3180)
2828

2929
* `geom_ribbon()` now draws separate lines for the upper and lower intervals if
30-
`colour` is mapped by default. Similarly, `geom_area()` now draws lines for
31-
the upper in the same case by default. If you want old-style full stroking,
32-
use `outlier.type = "legacy"` (#3503, @yutannihilation).
30+
`colour` is mapped. Similarly, `geom_area()` and `geom_density()` now draw
31+
the upper lines only in the same case by default. If you want old-style full
32+
stroking, use `outline.type = "full"` (@yutannihilation, #3503 / @thomasp85, #3708).
3333

3434
## New features
3535

R/geom-density.r

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ geom_density <- function(mapping = NULL, data = NULL,
5959
show.legend = NA,
6060
inherit.aes = TRUE,
6161
outline.type = "upper") {
62-
outline.type <- match.arg(outline.type, c("both", "upper", "lower", "legacy"))
62+
outline.type <- match.arg(outline.type, c("both", "upper", "lower", "full"))
6363

6464
layer(
6565
data = data,

R/geom-ribbon.r

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#' @inheritParams geom_bar
2424
#' @param outline.type Type of the outline of the area; `"both"` draws both the
2525
#' upper and lower lines, `"upper"`/`"lower"` draws the either lines only.
26-
#' `"legacy"` draws a closed polygon around the area.
26+
#' `"full"` draws a closed polygon around the area.
2727
#' @export
2828
#' @examples
2929
#' # Generate data
@@ -49,7 +49,7 @@ geom_ribbon <- function(mapping = NULL, data = NULL,
4949
show.legend = NA,
5050
inherit.aes = TRUE,
5151
outline.type = "both") {
52-
outline.type <- match.arg(outline.type, c("both", "upper", "lower", "legacy"))
52+
outline.type <- match.arg(outline.type, c("both", "upper", "lower", "full"))
5353

5454
layer(
5555
data = data,
@@ -143,13 +143,11 @@ GeomRibbon <- ggproto("GeomRibbon", Geom,
143143
default.units = "native",
144144
gp = gpar(
145145
fill = alpha(aes$fill, aes$alpha),
146-
col = if (identical(outline.type, "legacy")) aes$colour else NA
146+
col = if (identical(outline.type, "full")) aes$colour else NA
147147
)
148148
)
149149

150-
if (identical(outline.type, "legacy")) {
151-
warn(glue('outline.type = "legacy" is only for backward-compatibility ',
152-
'and might be removed eventually'))
150+
if (identical(outline.type, "full")) {
153151
return(ggname("geom_ribbon", g_poly))
154152
}
155153

@@ -181,7 +179,7 @@ geom_area <- function(mapping = NULL, data = NULL, stat = "identity",
181179
position = "stack", na.rm = FALSE, orientation = NA,
182180
show.legend = NA, inherit.aes = TRUE, ...,
183181
outline.type = "upper") {
184-
outline.type <- match.arg(outline.type, c("both", "upper", "lower", "legacy"))
182+
outline.type <- match.arg(outline.type, c("both", "upper", "lower", "full"))
185183

186184
layer(
187185
data = data,

man/geom_density.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/geom_ribbon.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test-geom-ribbon.R

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,7 @@ test_that("outline.type option works", {
3535
g_ribbon_default <- layer_grob(p + geom_ribbon())[[1]]
3636
g_ribbon_upper <- layer_grob(p + geom_ribbon(outline.type = "upper"))[[1]]
3737
g_ribbon_lower <- layer_grob(p + geom_ribbon(outline.type = "lower"))[[1]]
38-
g_ribbon_legacy <- expect_warning(
39-
layer_grob(p + geom_ribbon(outline.type = "legacy"))[[1]],
40-
'outline.type = "legacy" is only for backward-compatibility and might be removed eventually',
41-
fixed = TRUE
42-
)
38+
g_ribbon_full <- layer_grob(p + geom_ribbon(outline.type = "full"))[[1]]
4339
g_area_default <- layer_grob(ggplot(df, aes(x, y)) + geom_area())[[1]]
4440

4541
# default
@@ -57,8 +53,8 @@ test_that("outline.type option works", {
5753
expect_s3_class(g_ribbon_lower$children[[1]]$children[[2]], "polyline")
5854
expect_equal(g_ribbon_lower$children[[1]]$children[[2]]$id, rep(c(NA, 1L), each = 4))
5955

60-
# legacy
61-
expect_s3_class(g_ribbon_legacy$children[[1]], "polygon")
56+
# full
57+
expect_s3_class(g_ribbon_full$children[[1]], "polygon")
6258

6359
# geom_area()'s default is upper
6460
expect_s3_class(g_area_default$children[[1]]$children[[1]], "polygon")

0 commit comments

Comments
 (0)