diff --git a/DESCRIPTION b/DESCRIPTION index 0ee1405acf..ca5fe573b0 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: plotly Title: Create Interactive Web Graphics via Plotly's JavaScript Graphing Library -Version: 2.0.12 +Version: 2.0.13 Authors@R: c(person("Carson", "Sievert", role = c("aut", "cre"), email = "cpsievert1@gmail.com"), person("Chris", "Parmer", role = c("aut", "cph"), diff --git a/NEWS b/NEWS index 712f4a1097..313c4139a6 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +2.0.13 -- 12 Dec 2015 + +Fix #286 + 2.0.12 -- 11 Dec 2015 Fix #221 diff --git a/R/trace_generation.R b/R/trace_generation.R index 28b3cde411..5a8838179c 100644 --- a/R/trace_generation.R +++ b/R/trace_generation.R @@ -354,10 +354,10 @@ toBasic <- list( group2NA(g, "path") }, boxplot=function(g) { - # Preserve default colour values usign fill: + # Preserve default colour values using fill: if (!is.null(g$data$fill)) { - levels(g$prestats.data$fill) <- g$data$fill - g$prestats.data$fill <- as.character(g$prestats.data$fill) + g$prestats.data$fill <- NULL + g$prestats.data <- plyr::join(g$prestats.data, g$data[c("x", "fill")], by = "x") } g$data <- g$prestats.data g diff --git a/tests/testthat/test-ggplot-boxplot.R b/tests/testthat/test-ggplot-boxplot.R index 295a8176d0..17a69a9122 100644 --- a/tests/testthat/test-ggplot-boxplot.R +++ b/tests/testthat/test-ggplot-boxplot.R @@ -42,3 +42,20 @@ test_that("you can make a boxplot for a distribution of datetimes", { expect_identical(L$data[[1]]$type, "box") expect_identical(L$data[[1]]$y, as.character(df$y)) }) + +dat <- data.frame( + cond = factor(rep(c("A", "B", "C", "D"), each = 200)), + col = factor(rep(c("C1", "C2"), each = 400)), + rating = c(rnorm(200), rnorm(200, mean=.8), rnorm(200, mean=.4), rnorm(200, mean=.2)) +) +g <- ggplot(dat, aes(x = cond, y = rating)) + + geom_boxplot(outlier.shape = NA, aes(fill = col)) + +test_that("correct # of unique fillcolors", { + L <- save_outputs(g, "boxplot-fillcolor") + expect_equal(length(L$data), 4) + expect_identical(L$data[[1]]$type, "box") + fills <- sapply(L$data, "[[", "fillcolor") + expect_equal(length(unique(fills)), length(unique(dat$col))) +}) +