@@ -176,21 +176,21 @@ geom_boxplot <- function(mapping = NULL, data = NULL,
176
176
# ' @export
177
177
GeomBoxplot <- ggproto(" GeomBoxplot" , Geom ,
178
178
179
- # need to declare `width` here in case this geom is used with a stat that
180
- # doesn't have a `width` parameter (e.g., `stat_identity`).
181
- extra_params = c(" na.rm" , " width" , " orientation" , " outliers" ),
179
+ extra_params = c(" na.rm" , " orientation" , " outliers" ),
182
180
183
181
setup_params = function (data , params ) {
184
182
params $ flipped_aes <- has_flipped_aes(data , params )
185
183
params
186
184
},
187
185
188
- setup_data = function (data , params ) {
186
+ setup_data = function (self , data , params ) {
189
187
data $ flipped_aes <- params $ flipped_aes
190
188
data <- flip_data(data , params $ flipped_aes )
191
- data $ width <- data $ width %|| %
192
- params $ width %|| % (resolution(data $ x , FALSE , TRUE ) * 0.9 )
193
-
189
+ data <- compute_data_size(
190
+ data , params $ width ,
191
+ default = self $ default_aes $ width ,
192
+ zero = FALSE , discrete = TRUE
193
+ )
194
194
if (isFALSE(params $ outliers )) {
195
195
data $ outliers <- NULL
196
196
}
@@ -331,7 +331,8 @@ GeomBoxplot <- ggproto("GeomBoxplot", Geom,
331
331
weight = 1 , colour = from_theme(col_mix(ink , paper , 0.2 )),
332
332
fill = from_theme(paper ), size = from_theme(pointsize ),
333
333
alpha = NA , shape = from_theme(pointshape ), linetype = from_theme(bordertype ),
334
- linewidth = from_theme(borderwidth )
334
+ linewidth = from_theme(borderwidth ),
335
+ width = 0.9
335
336
),
336
337
337
338
required_aes = c(" x|y" , " lower|xlower" , " upper|xupper" , " middle|xmiddle" , " ymin|xmin" , " ymax|xmax" ),
0 commit comments