26
26
stat_ydensity <- function (mapping = NULL , data = NULL ,
27
27
geom = " violin" , position = " dodge" ,
28
28
... ,
29
+ draw_quantiles = NULL ,
29
30
bw = " nrd0" ,
30
31
adjust = 1 ,
31
32
kernel = " gaussian" ,
@@ -56,6 +57,7 @@ stat_ydensity <- function(mapping = NULL, data = NULL,
56
57
drop = drop ,
57
58
na.rm = na.rm ,
58
59
bounds = bounds ,
60
+ draw_quantiles = draw_quantiles ,
59
61
...
60
62
)
61
63
)
@@ -80,7 +82,8 @@ StatYdensity <- ggproto("StatYdensity", Stat,
80
82
81
83
compute_group = function (self , data , scales , width = NULL , bw = " nrd0" , adjust = 1 ,
82
84
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 ) {
84
87
if (nrow(data ) < 2 ) {
85
88
if (isTRUE(drop )) {
86
89
cli :: cli_warn(c(
@@ -121,11 +124,12 @@ StatYdensity <- ggproto("StatYdensity", Stat,
121
124
compute_panel = function (self , data , scales , width = NULL , bw = " nrd0" , adjust = 1 ,
122
125
kernel = " gaussian" , trim = TRUE , na.rm = FALSE ,
123
126
scale = " area" , flipped_aes = FALSE , drop = TRUE ,
124
- bounds = c(- Inf , Inf )) {
127
+ bounds = c(- Inf , Inf ), draw_quantiles = NULL ) {
125
128
data <- flip_data(data , flipped_aes )
126
129
data <- ggproto_parent(Stat , self )$ compute_panel(
127
130
data , scales , width = width , bw = bw , adjust = adjust , kernel = kernel ,
128
131
trim = trim , na.rm = na.rm , drop = drop , bounds = bounds ,
132
+ draw_quantiles = draw_quantiles
129
133
)
130
134
if (! drop && any(data $ n < 2 )) {
131
135
cli :: cli_warn(
0 commit comments