Skip to content

Commit 3403811

Browse files
committed
plumbing for draw_quantiles in stat_ydensity()
1 parent 28aec3a commit 3403811

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

R/stat-ydensity.R

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
stat_ydensity <- function(mapping = NULL, data = NULL,
2727
geom = "violin", position = "dodge",
2828
...,
29+
draw_quantiles = NULL,
2930
bw = "nrd0",
3031
adjust = 1,
3132
kernel = "gaussian",
@@ -56,6 +57,7 @@ stat_ydensity <- function(mapping = NULL, data = NULL,
5657
drop = drop,
5758
na.rm = na.rm,
5859
bounds = bounds,
60+
draw_quantiles = draw_quantiles,
5961
...
6062
)
6163
)
@@ -80,7 +82,8 @@ StatYdensity <- ggproto("StatYdensity", Stat,
8082

8183
compute_group = function(self, data, scales, width = NULL, bw = "nrd0", adjust = 1,
8284
kernel = "gaussian", trim = TRUE, na.rm = FALSE,
83-
drop = TRUE, flipped_aes = FALSE, bounds = c(-Inf, Inf)) {
85+
drop = TRUE, flipped_aes = FALSE, bounds = c(-Inf, Inf),
86+
draw_quantiles = NULL) {
8487
if (nrow(data) < 2) {
8588
if (isTRUE(drop)) {
8689
cli::cli_warn(c(
@@ -121,11 +124,12 @@ StatYdensity <- ggproto("StatYdensity", Stat,
121124
compute_panel = function(self, data, scales, width = NULL, bw = "nrd0", adjust = 1,
122125
kernel = "gaussian", trim = TRUE, na.rm = FALSE,
123126
scale = "area", flipped_aes = FALSE, drop = TRUE,
124-
bounds = c(-Inf, Inf)) {
127+
bounds = c(-Inf, Inf), draw_quantiles = NULL) {
125128
data <- flip_data(data, flipped_aes)
126129
data <- ggproto_parent(Stat, self)$compute_panel(
127130
data, scales, width = width, bw = bw, adjust = adjust, kernel = kernel,
128131
trim = trim, na.rm = na.rm, drop = drop, bounds = bounds,
132+
draw_quantiles = draw_quantiles
129133
)
130134
if (!drop && any(data$n < 2)) {
131135
cli::cli_warn(

0 commit comments

Comments
 (0)