Skip to content

Commit 89120e8

Browse files
authored
Set outline type for geom_density as geom_area (#3708)
1 parent 891ee88 commit 89120e8

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

R/geom-density.r

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#' See [geom_violin()] for a compact density display.
1313
#' @inheritParams layer
1414
#' @inheritParams geom_bar
15+
#' @inheritParams geom_ribbon
1516
#' @param geom,stat Use to override the default connection between
1617
#' `geom_density` and `stat_density`.
1718
#' @export
@@ -56,7 +57,9 @@ geom_density <- function(mapping = NULL, data = NULL,
5657
na.rm = FALSE,
5758
orientation = NA,
5859
show.legend = NA,
59-
inherit.aes = TRUE) {
60+
inherit.aes = TRUE,
61+
outline.type = "upper") {
62+
outline.type <- match.arg(outline.type, c("both", "upper", "lower", "legacy"))
6063

6164
layer(
6265
data = data,
@@ -69,6 +72,7 @@ geom_density <- function(mapping = NULL, data = NULL,
6972
params = list(
7073
na.rm = na.rm,
7174
orientation = orientation,
75+
outline.type = outline.type,
7276
...
7377
)
7478
)

man/geom_density.Rd

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

tests/testthat/test-function-args.r

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ test_that("geom_xxx and GeomXxx$draw arg defaults match", {
1414
geom_fun_names <- setdiff(
1515
geom_fun_names,
1616
c("geom_map", "geom_sf", "geom_smooth", "geom_column", "geom_area",
17-
"annotation_custom", "annotation_map",
18-
"annotation_raster", "annotation_id")
17+
"geom_density", "annotation_custom", "annotation_map", "annotation_raster",
18+
"annotation_id")
1919
)
2020

2121
# For each geom_xxx function and the corresponding GeomXxx$draw and

0 commit comments

Comments
 (0)