diff --git a/NEWS.md b/NEWS.md index d447b0e5ed..1dca589fc1 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,10 @@ # ggplot2 2.1.0.9000 +* `geom_boxplot` gain new `outlier.fill` argument for controlling the fill of + outlier points independently of the alpha of the boxes. + Analogous to outlier.colour, outlier.shape, etc. + (@schloerke, #1787). + * Overhaul of how discrete missing values are treated (#1584). The underlying principle is that we can naturally represent missing values on discrete variables (by treating just like another level), so by default diff --git a/R/geom-boxplot.r b/R/geom-boxplot.r index 9719d8fd4b..3ea73a4ec0 100644 --- a/R/geom-boxplot.r +++ b/R/geom-boxplot.r @@ -26,7 +26,7 @@ #' @inheritParams geom_point #' @param geom,stat Use to override the default connection between #' \code{geom_boxplot} and \code{stat_boxplot}. -#' @param outlier.colour,outlier.color,outlier.shape,outlier.size,outlier.stroke,outlier.alpha +#' @param outlier.colour,outlier.color,outlier.fill,outlier.shape,outlier.size,outlier.stroke,outlier.alpha #' Default aesthetics for outliers. Set to \code{NULL} to inherit from the #' aesthetics used for the box. #' @@ -93,6 +93,7 @@ geom_boxplot <- function(mapping = NULL, data = NULL, ..., outlier.colour = NULL, outlier.color = NULL, + outlier.fill = NULL, outlier.shape = 19, outlier.size = 1.5, outlier.stroke = 0.5, @@ -113,6 +114,7 @@ geom_boxplot <- function(mapping = NULL, data = NULL, inherit.aes = inherit.aes, params = list( outlier.colour = outlier.color %||% outlier.colour, + outlier.fill = outlier.fill, outlier.shape = outlier.shape, outlier.size = outlier.size, outlier.stroke = outlier.stroke, @@ -162,7 +164,8 @@ GeomBoxplot <- ggproto("GeomBoxplot", Geom, }, draw_group = function(data, panel_scales, coord, fatten = 2, - outlier.colour = NULL, outlier.shape = 19, + outlier.colour = NULL, outlier.fill = NULL, + outlier.shape = 19, outlier.size = 1.5, outlier.stroke = 0.5, outlier.alpha = NULL, notch = FALSE, notchwidth = 0.5, varwidth = FALSE) { @@ -205,6 +208,7 @@ GeomBoxplot <- ggproto("GeomBoxplot", Geom, y = data$outliers[[1]], x = data$x[1], colour = outlier.colour %||% data$colour[1], + fill = outlier.fill %||% data$fill[1], shape = outlier.shape %||% data$shape[1], size = outlier.size %||% data$size[1], stroke = outlier.stroke %||% data$stroke[1], diff --git a/man/geom_boxplot.Rd b/man/geom_boxplot.Rd index a8da6f036e..13a91c8b57 100644 --- a/man/geom_boxplot.Rd +++ b/man/geom_boxplot.Rd @@ -7,9 +7,10 @@ \usage{ geom_boxplot(mapping = NULL, data = NULL, stat = "boxplot", position = "dodge", ..., outlier.colour = NULL, outlier.color = NULL, - outlier.shape = 19, outlier.size = 1.5, outlier.stroke = 0.5, - outlier.alpha = NULL, notch = FALSE, notchwidth = 0.5, - varwidth = FALSE, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE) + outlier.fill = NULL, outlier.shape = 19, outlier.size = 1.5, + outlier.stroke = 0.5, outlier.alpha = NULL, notch = FALSE, + notchwidth = 0.5, varwidth = FALSE, na.rm = FALSE, show.legend = NA, + inherit.aes = TRUE) stat_boxplot(mapping = NULL, data = NULL, geom = "boxplot", position = "dodge", ..., coef = 1.5, na.rm = FALSE, show.legend = NA, @@ -43,7 +44,7 @@ often aesthetics, used to set an aesthetic to a fixed value, like \code{color = "red"} or \code{size = 3}. They may also be parameters to the paired geom/stat.} -\item{outlier.colour, outlier.color, outlier.shape, outlier.size, outlier.stroke, outlier.alpha}{Default aesthetics for outliers. Set to \code{NULL} to inherit from the +\item{outlier.colour, outlier.color, outlier.fill, outlier.shape, outlier.size, outlier.stroke, outlier.alpha}{Default aesthetics for outliers. Set to \code{NULL} to inherit from the aesthetics used for the box. In the unlikely event you specify both US and UK spellings of colour, the