From ef5067a563491ac34c89681e2a8aeeffe909f913 Mon Sep 17 00:00:00 2001 From: Carson Sievert Date: Mon, 8 Apr 2019 13:38:37 -0500 Subject: [PATCH 1/3] require CRAN version of shinytest --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index ac1c5b3b40..616cf4e9fb 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -54,7 +54,7 @@ Suggests: knitr, devtools, shiny (>= 1.1.0), - shinytest (> 1.3.0), + shinytest (>= 1.3.0), curl, rmarkdown, vdiffr, From f9f28448abbdec06a033f4bebdafc1060859545d Mon Sep 17 00:00:00 2001 From: Carson Sievert Date: Mon, 8 Apr 2019 17:41:54 -0500 Subject: [PATCH 2/3] respect outlier.* params in geom_boxplot() --- R/layers2traces.R | 41 ++++++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/R/layers2traces.R b/R/layers2traces.R index fba34f75c9..eff74e67c4 100644 --- a/R/layers2traces.R +++ b/R/layers2traces.R @@ -777,7 +777,7 @@ geom2trace.GeomPolygon <- function(data, params, p) { #' @export geom2trace.GeomBoxplot <- function(data, params, p) { - compact(list( + trace <- compact(list( x = data[["x"]], y = data[["y"]], hoverinfo = "y", @@ -790,22 +790,38 @@ geom2trace.GeomBoxplot <- function(data, params, p) { aes2plotly(data, params, "fill"), aes2plotly(data, params, "alpha") ), - # marker styling must inherit from GeomPoint$default_aes - # https://github.com/hadley/ggplot2/blob/ab42c2ca81458b0cf78e3ba47ed5db21f4d0fc30/NEWS#L73-L77 - marker = list( - opacity = GeomPoint$default_aes$alpha, - outliercolor = toRGB(GeomPoint$default_aes$colour), - line = list( - width = mm2pixels(GeomPoint$default_aes$stroke), - color = toRGB(GeomPoint$default_aes$colour) - ), - size = mm2pixels(GeomPoint$default_aes$size) - ), line = list( color = aes2plotly(data, params, "colour"), width = aes2plotly(data, params, "size") ) )) + + # handle special `outlier.shape=NA` case + if (is.na(params$outlier.shape)) { + params$outlier.alpha <- 0 + } + + # redefine aes meaning using outlier params + data$alpha <- params$outlier.alpha %||% data$alpha + data$fill <- params$outlier.fill %||% data$fill + data$shape <- params$outlier.shape %||% data$shape + data$stroke <- params$outlier.stroke %||% data$stroke + data$colour <- params$outlier.colour %||% data$colour + data$size <- params$outlier.size %||% data$size + + trace$marker <- list( + opacity = aes2plotly(data, params, "alpha"), + # I don't think this is relevant if line.color is defined? + color = aes2plotly(data, params, "fill"), + symbol = aes2plotly(data, params, "shape"), + line = list( + width = aes2plotly(data, params, "stroke"), + color = aes2plotly(data, params, "colour") + ), + size = aes2plotly(data, params, "size") + ) + + trace } @@ -1007,7 +1023,6 @@ aes2plotly <- function(data, params, aes = "size") { # https://github.com/ropensci/plotly/pull/1481 if ("default_aes" %in% names(geom_obj)) geom_obj$default_aes else NULL } - vals <- uniq(data[[aes]]) %||% params[[aes]] %||% defaults[[aes]] %||% NA converter <- switch( aes, From 62a9792965c3fd16d528023e11cc55e29a037c1e Mon Sep 17 00:00:00 2001 From: Carson Sievert Date: Mon, 8 Apr 2019 17:47:43 -0500 Subject: [PATCH 3/3] respect notch/notchwidth --- R/layers2traces.R | 2 ++ 1 file changed, 2 insertions(+) diff --git a/R/layers2traces.R b/R/layers2traces.R index eff74e67c4..19bdae76a7 100644 --- a/R/layers2traces.R +++ b/R/layers2traces.R @@ -786,6 +786,8 @@ geom2trace.GeomBoxplot <- function(data, params, p) { frame = data[["frame"]], ids = data[["ids"]], type = "box", + notched = params[["notch"]], + notchwidth = params[["notchwidth"]], fillcolor = toRGB( aes2plotly(data, params, "fill"), aes2plotly(data, params, "alpha")