diff --git a/DESCRIPTION b/DESCRIPTION index e857c8701d..9582928e1e 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.10 +Version: 2.0.11 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 686c9a1d40..88d1df09ec 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +2.0.11 -- 11 Dec 2015 + +Fix #250 + 2.0.10 -- 10 Dec 2015 Fix #225 diff --git a/R/ggplotly.R b/R/ggplotly.R index fcad2e1bae..b0d31db54f 100644 --- a/R/ggplotly.R +++ b/R/ggplotly.R @@ -851,7 +851,7 @@ gg2list <- function(p) { tr.attr <- tr[[must.be.equal]] criteria[[must.be.equal]] <- isTRUE(all.equal(other.attr, tr.attr)) } - if(all(criteria)){ + if(all(criteria) && tr$type != "bar"){ can.merge[[other.i]] <- TRUE } } diff --git a/tests/testthat.R b/tests/testthat.R index 3c4b9918dd..b3defa749b 100644 --- a/tests/testthat.R +++ b/tests/testthat.R @@ -58,7 +58,7 @@ save_outputs <- function(gg, name) { res <- RSassign(conn, plotly:::plotlyEnv, "plotlyEnv") res <- RSeval(conn, "unlockBinding('plotlyEnv', asNamespace('plotly'))") res <- RSeval(conn, "assign('plotlyEnv', plotlyEnv, pos = asNamespace('plotly'))") - pm <- RSeval(conn, "plotly::plotly_build(gg)") + pm <- RSeval(conn, "tryCatch(plotly::plotly_build(gg), error = function(e) 'plotly build error')") # it could be that the hash didn't exist, so make sure they're different if (plot_hash != digest::digest(pm)) { test_dir <- file.path(this_dir, gsub("\\s+", "-", name)) diff --git a/tests/testthat/test-ggplot-stack.R b/tests/testthat/test-ggplot-stack.R index 9b1792fbfc..8cc0ae6c1d 100644 --- a/tests/testthat/test-ggplot-stack.R +++ b/tests/testthat/test-ggplot-stack.R @@ -21,3 +21,19 @@ test_that("y value is non-cumulative in stacked bar charts", { expect_equal(L$data[[2]]$y[2], instructors$number[5]) expect_equal(L$data[[3]]$y[2], instructors$number[6]) }) + +testd <- data.frame( + group1 = rep(1:3, each = 3), + group2 = LETTERS[1:3], + # We have two 0.2 within each group. + count = c(0.2, 0.2, 0.6) +) + +test_that("can stack identical traces", { + p1 <- ggplot(testd, aes(x = factor(group1), y = count, + fill = factor(group2))) + + geom_bar(stat = 'identity', width = 1, position = "stack") + L <- save_outputs(p1, "stack-identical") + expect_equal(length(L$data), 3) +}) +