@@ -236,21 +236,21 @@ geom_boxplot <- function(mapping = NULL, data = NULL,
236236# ' @export
237237GeomBoxplot <- ggproto(" GeomBoxplot" , Geom ,
238238
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" ),
242240
243241 setup_params = function (data , params ) {
244242 params $ flipped_aes <- has_flipped_aes(data , params )
245243 params
246244 },
247245
248- setup_data = function (data , params ) {
246+ setup_data = function (self , data , params ) {
249247 data $ flipped_aes <- params $ flipped_aes
250248 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+ )
254254 if (isFALSE(params $ outliers )) {
255255 data $ outliers <- NULL
256256 }
@@ -389,7 +389,8 @@ GeomBoxplot <- ggproto("GeomBoxplot", Geom,
389389 weight = 1 , colour = from_theme(col_mix(ink , paper , 0.2 )),
390390 fill = from_theme(paper ), size = from_theme(pointsize ),
391391 alpha = NA , shape = from_theme(pointshape ), linetype = from_theme(bordertype ),
392- linewidth = from_theme(borderwidth )
392+ linewidth = from_theme(borderwidth ),
393+ width = 0.9
393394 ),
394395
395396 required_aes = c(" x|y" , " lower|xlower" , " upper|xupper" , " middle|xmiddle" , " ymin|xmin" , " ymax|xmax" ),
0 commit comments