diff --git a/NEWS b/NEWS index 36d94c993..12746fc39 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,3 @@ - ggplot2 1.0.1 ---------------------------------------------------------------- diff --git a/NEWS.md b/NEWS.md index 7a1e12a39..b0358a6fd 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,10 @@ # ggplot2 2.1.0.9000 +* `geom_boxplot` gain new `outlier.alpha` argument for controlling the alpha of + outlier points independently of the alpha of the boxes. + Analogous to outlier.colour, outlier.shape, etc. + (@jonathan-g). + * FP adjustment for histogram bins is now actually used - it was previously inadvertently ignored (#1651). @@ -57,7 +62,7 @@ * Minor code formatting and grammar issues in examples and function parameters were fixed. (@hrbrmstr) - + * `geom_col()` was added to complement `geom_bar()`. It uses `stat="identity"` by default, making the `y` aesthetic mandatory. It does not support any other `stat_()` and does not provide fallback support for the `binwidth` @@ -66,7 +71,7 @@ * Fix error message of Stats ggprotos when required aesthetics are missing. - + * Fix bug that resulted in several annotation_x function not getting drawn when global data was lacking (#1655) @@ -136,9 +141,9 @@ * `bins = n` now gives a histogram with `n` bins, not `n + 1` (#1487). -## Bug fixes +## Bug fixes -* All `\donttest{}` examples run. +* All `\donttest{}` examples run. * All `geom_()` and `stat_()` functions now have consistent argument order: data + mapping, then geom/stat/position, then `...`, then specific arguments, diff --git a/R/geom-boxplot.r b/R/geom-boxplot.r index 94c41dffc..e10acb842 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 +#' @param outlier.colour,outlier.color,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. #' @@ -67,6 +67,8 @@ #' geom_boxplot() #' ggplot(diamonds, aes(carat, price)) + #' geom_boxplot(aes(group = cut_width(carat, 0.25))) +#' ggplot(diamonds, aes(carat, price)) + +#' geom_boxplot(aes(group = cut_width(carat, 0.25)), outlier.alpha = 0.1) #' #' \donttest{ #' # It's possible to draw a boxplot with your own computations if you @@ -94,6 +96,7 @@ geom_boxplot <- function(mapping = NULL, data = NULL, outlier.shape = 19, outlier.size = 1.5, outlier.stroke = 0.5, + outlier.alpha = NULL, notch = FALSE, notchwidth = 0.5, varwidth = FALSE, @@ -113,6 +116,7 @@ geom_boxplot <- function(mapping = NULL, data = NULL, outlier.shape = outlier.shape, outlier.size = outlier.size, outlier.stroke = outlier.stroke, + outlier.alpha = outlier.alpha, notch = notch, notchwidth = notchwidth, varwidth = varwidth, @@ -160,6 +164,7 @@ GeomBoxplot <- ggproto("GeomBoxplot", Geom, draw_group = function(data, panel_scales, coord, fatten = 2, outlier.colour = NULL, outlier.shape = 19, outlier.size = 1.5, outlier.stroke = 0.5, + outlier.alpha = NULL, notch = FALSE, notchwidth = 0.5, varwidth = FALSE) { common <- data.frame( @@ -204,7 +209,7 @@ GeomBoxplot <- ggproto("GeomBoxplot", Geom, size = outlier.size %||% data$size[1], stroke = outlier.stroke %||% data$stroke[1], fill = NA, - alpha = NA, + alpha = outlier.alpha %||% data$alpha[1], stringsAsFactors = FALSE ) outliers_grob <- GeomPoint$draw_panel(outliers, panel_scales, coord) diff --git a/man/geom_boxplot.Rd b/man/geom_boxplot.Rd index 5756fc1ab..c5d096bd3 100644 --- a/man/geom_boxplot.Rd +++ b/man/geom_boxplot.Rd @@ -8,8 +8,8 @@ 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, - notch = FALSE, notchwidth = 0.5, varwidth = FALSE, na.rm = FALSE, - show.legend = NA, inherit.aes = TRUE) + 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 +43,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}{Default aesthetics for outliers. Set to \code{NULL} to inherit from the +\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 aesthetics used for the box. In the unlikely event you specify both US and UK spellings of colour, the @@ -137,6 +137,8 @@ ggplot(diamonds, aes(carat, price)) + geom_boxplot() ggplot(diamonds, aes(carat, price)) + geom_boxplot(aes(group = cut_width(carat, 0.25))) +ggplot(diamonds, aes(carat, price)) + + geom_boxplot(aes(group = cut_width(carat, 0.25)), outlier.alpha = 0.1) \donttest{ # It's possible to draw a boxplot with your own computations if you