@@ -236,21 +236,21 @@ geom_boxplot <- function(mapping = NULL, data = NULL,
236
236
# ' @export
237
237
GeomBoxplot <- ggproto(" GeomBoxplot" , Geom ,
238
238
239
- # need to declare `width` here in case this geom is used with a stat that
240
- # doesn't have a `width` parameter (e.g., `stat_identity`).
241
- extra_params = c(" na.rm" , " width" , " orientation" , " outliers" ),
239
+ extra_params = c(" na.rm" , " orientation" , " outliers" ),
242
240
243
241
setup_params = function (data , params ) {
244
242
params $ flipped_aes <- has_flipped_aes(data , params )
245
243
params
246
244
},
247
245
248
- setup_data = function (data , params ) {
246
+ setup_data = function (self , data , params ) {
249
247
data $ flipped_aes <- params $ flipped_aes
250
248
data <- flip_data(data , params $ flipped_aes )
251
- data $ width <- data $ width %|| %
252
- params $ width %|| % (resolution(data $ x , FALSE , TRUE ) * 0.9 )
253
-
249
+ data <- compute_data_size(
250
+ data , params $ width ,
251
+ default = self $ default_aes $ width ,
252
+ zero = FALSE , discrete = TRUE
253
+ )
254
254
if (isFALSE(params $ outliers )) {
255
255
data $ outliers <- NULL
256
256
}
@@ -389,7 +389,8 @@ GeomBoxplot <- ggproto("GeomBoxplot", Geom,
389
389
weight = 1 , colour = from_theme(col_mix(ink , paper , 0.2 )),
390
390
fill = from_theme(paper ), size = from_theme(pointsize ),
391
391
alpha = NA , shape = from_theme(pointshape ), linetype = from_theme(bordertype ),
392
- linewidth = from_theme(borderwidth )
392
+ linewidth = from_theme(borderwidth ),
393
+ width = 0.9
393
394
),
394
395
395
396
required_aes = c(" x|y" , " lower|xlower" , " upper|xupper" , " middle|xmiddle" , " ymin|xmin" , " ymax|xmax" ),
0 commit comments