Skip to content

Set outline type for geom_density as geom_area #3708

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 2 commits into from
Jan 8, 2020
Merged
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
6 changes: 5 additions & 1 deletion R/geom-density.r
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#' See [geom_violin()] for a compact density display.
#' @inheritParams layer
#' @inheritParams geom_bar
#' @inheritParams geom_ribbon
#' @param geom,stat Use to override the default connection between
#' `geom_density` and `stat_density`.
#' @export
Expand Down Expand Up @@ -56,7 +57,9 @@ geom_density <- function(mapping = NULL, data = NULL,
na.rm = FALSE,
orientation = NA,
show.legend = NA,
inherit.aes = TRUE) {
inherit.aes = TRUE,
outline.type = "upper") {
outline.type <- match.arg(outline.type, c("both", "upper", "lower", "legacy"))

layer(
data = data,
Expand All @@ -69,6 +72,7 @@ geom_density <- function(mapping = NULL, data = NULL,
params = list(
na.rm = na.rm,
orientation = orientation,
outline.type = outline.type,
...
)
)
Expand Down
7 changes: 6 additions & 1 deletion man/geom_density.Rd

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

4 changes: 2 additions & 2 deletions tests/testthat/test-function-args.r
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ test_that("geom_xxx and GeomXxx$draw arg defaults match", {
geom_fun_names <- setdiff(
geom_fun_names,
c("geom_map", "geom_sf", "geom_smooth", "geom_column", "geom_area",
"annotation_custom", "annotation_map",
"annotation_raster", "annotation_id")
"geom_density", "annotation_custom", "annotation_map", "annotation_raster",
"annotation_id")
)

# For each geom_xxx function and the corresponding GeomXxx$draw and
Expand Down