Skip to content

Commit daddf74

Browse files
authored
define "width" parameter for geom_boxplot. Closes #2893. (#2898)
1 parent 4b880bb commit daddf74

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

NEWS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# ggplot2 3.0.0.9000
22

3+
* `geom_boxplot()` now understands the `width` parameter even when used with
4+
a non-standard stat, such as `stat_identity()` (@clauswilke, #2893).
5+
36
* `scale_*_date()`, `scale_*_time()` and `scale_*_datetime()` can now display
47
a secondary axis that is a __one-to-one__ transformation of the primary axis,
58
implemented using the `sec.axis` argument to the scale constructor

R/geom-boxplot.r

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,11 @@ geom_boxplot <- function(mapping = NULL, data = NULL,
158158
#' @usage NULL
159159
#' @export
160160
GeomBoxplot <- ggproto("GeomBoxplot", Geom,
161+
162+
# need to declare `width`` here in case this geom is used with a stat that
163+
# doesn't have a `width` parameter (e.g., `stat_identity`).
164+
extra_params = c("na.rm", "width"),
165+
161166
setup_data = function(data, params) {
162167
data$width <- data$width %||%
163168
params$width %||% (resolution(data$x, FALSE) * 0.9)

0 commit comments

Comments
 (0)