From 57faddd1c97a6d9fcfffec29f5dbdb79cb1471d3 Mon Sep 17 00:00:00 2001 From: Jonathan Gilligan Date: Sat, 26 Mar 2016 14:07:35 -0500 Subject: [PATCH 1/7] Added outlier.alpha to options for geom_boxplot. --- DESCRIPTION | 2 +- R/geom-boxplot.r | 7 +++++-- man/geom_boxplot.Rd | 6 +++--- man/labs.Rd | 2 +- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 27c50cb52..724f64840 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: ggplot2 -Version: 2.1.0 +Version: 2.1.0.9001 Authors@R: c( person("Hadley", "Wickham", , "hadley@rstudio.com", c("aut", "cre")), person("Winston", "Chang", , "winston@rstudio.com", "aut"), diff --git a/R/geom-boxplot.r b/R/geom-boxplot.r index 8623b3b4e..9ba2e2222 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. #' @@ -94,6 +94,7 @@ geom_boxplot <- function(mapping = NULL, data = NULL, outlier.shape = 19, outlier.size = 1.5, outlier.stroke = 0.5, + outlier.alpha = NA, notch = FALSE, notchwidth = 0.5, varwidth = FALSE, @@ -113,6 +114,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 +162,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 = NA, notch = FALSE, notchwidth = 0.5, varwidth = FALSE) { common <- data.frame( @@ -204,7 +207,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 da1779819..1a9ecd666 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 = NA, 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 diff --git a/man/labs.Rd b/man/labs.Rd index 15c057f3f..d329d4bf3 100644 --- a/man/labs.Rd +++ b/man/labs.Rd @@ -19,7 +19,7 @@ ggtitle(label, subtitle = NULL) \arguments{ \item{...}{a list of new names in the form aesthetic = "new name"} -\item{label}{The text for the axis, plot title or caption below the plot} +\item{label}{The text for the axis, plot title or caption below the plot.} \item{subtitle}{the text for the subtitle for the plot which will be displayed below the title. Leave \code{NULL} for no subtitle.} From cb741f8203555d330644592a67f53231628bae19 Mon Sep 17 00:00:00 2001 From: Jonathan Gilligan Date: Sun, 27 Mar 2016 00:11:03 -0500 Subject: [PATCH 2/7] Roll back development version number Roll back development version number in order to prepare for pull request to hadley's repo. --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 724f64840..27c50cb52 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: ggplot2 -Version: 2.1.0.9001 +Version: 2.1.0 Authors@R: c( person("Hadley", "Wickham", , "hadley@rstudio.com", c("aut", "cre")), person("Winston", "Chang", , "winston@rstudio.com", "aut"), From e34868ae6817847593ecd53ff2c1811b2e41c2f7 Mon Sep 17 00:00:00 2001 From: Jonathan Gilligan Date: Mon, 27 Jun 2016 11:46:57 -0500 Subject: [PATCH 3/7] Update NEWS --- NEWS | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NEWS b/NEWS index 36d94c993..d1be13081 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +* `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). ggplot2 1.0.1 ---------------------------------------------------------------- From cd62410d0eb83f45fad3859eba8e2b92ea9a7a3f Mon Sep 17 00:00:00 2001 From: Jonathan Gilligan Date: Fri, 29 Jul 2016 14:23:03 -0500 Subject: [PATCH 4/7] Made changes requested by Hadley. --- NEWS.md | 5 +++++ R/geom-boxplot.r | 4 +++- man/geom_boxplot.Rd | 6 ++++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/NEWS.md b/NEWS.md index 1a78485d6..ef03c1945 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). + * `x` and `y` scales are now symmetric regarding the list of aesthetics they accept: `xmin_final`, `xmax_final`, `xlower`, `xmiddle` and `xupper` are now valid `x` aesthetics. diff --git a/R/geom-boxplot.r b/R/geom-boxplot.r index 9ba2e2222..7dc5c902c 100644 --- a/R/geom-boxplot.r +++ b/R/geom-boxplot.r @@ -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,7 +96,7 @@ geom_boxplot <- function(mapping = NULL, data = NULL, outlier.shape = 19, outlier.size = 1.5, outlier.stroke = 0.5, - outlier.alpha = NA, + outlier.alpha = NULL, notch = FALSE, notchwidth = 0.5, varwidth = FALSE, diff --git a/man/geom_boxplot.Rd b/man/geom_boxplot.Rd index 1a9ecd666..980c3c00a 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, - outlier.alpha = NA, 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, @@ -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 From 32a27903071353cc5160899516d6df4eef889e11 Mon Sep 17 00:00:00 2001 From: Jonathan Gilligan Date: Fri, 29 Jul 2016 14:35:37 -0500 Subject: [PATCH 5/7] Fixed one last place where I set outlier.alpha to NA instead of NULL (see note by Hadley on PR). --- R/geom-boxplot.r | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/geom-boxplot.r b/R/geom-boxplot.r index 7dc5c902c..0809a7b95 100644 --- a/R/geom-boxplot.r +++ b/R/geom-boxplot.r @@ -164,7 +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 = NA, + outlier.alpha = NULL, notch = FALSE, notchwidth = 0.5, varwidth = FALSE) { common <- data.frame( From 6eb9b36e37a25aa84c4b0b4770a12910dc6a13dd Mon Sep 17 00:00:00 2001 From: Jonathan Gilligan Date: Fri, 29 Jul 2016 17:54:49 -0500 Subject: [PATCH 6/7] Corrected whitespace in news.md item. --- NEWS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index ef03c1945..c47b69587 100644 --- a/NEWS.md +++ b/NEWS.md @@ -3,7 +3,7 @@ * `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). + (@jonathan-g). * `x` and `y` scales are now symmetric regarding the list of aesthetics they accept: `xmin_final`, `xmax_final`, `xlower`, From c61acfe7234af4d64d718ea3c933218128b7674d Mon Sep 17 00:00:00 2001 From: Jonathan Gilligan Date: Sat, 30 Jul 2016 17:32:18 -0500 Subject: [PATCH 7/7] Cleaned up old NEWS file (moved note about outlier.alpha for geom_boxplot to NEWS.md) --- NEWS | 5 ----- 1 file changed, 5 deletions(-) diff --git a/NEWS b/NEWS index d1be13081..12746fc39 100644 --- a/NEWS +++ b/NEWS @@ -1,8 +1,3 @@ -* `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). - ggplot2 1.0.1 ----------------------------------------------------------------