Skip to content

Commit 326303a

Browse files
committed
Merge pull request #347 from ropensci/fix/merge
fix #346
2 parents 5509909 + ad1502d commit 326303a

File tree

4 files changed

+17
-9
lines changed

4 files changed

+17
-9
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: plotly
22
Title: Create Interactive Web Graphics via Plotly's JavaScript Graphing Library
3-
Version: 2.0.14
3+
Version: 2.0.15
44
Authors@R: c(person("Carson", "Sievert", role = c("aut", "cre"),
55
email = "[email protected]"),
66
person("Chris", "Parmer", role = c("aut", "cph"),

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2.0.15 -- 13 Dec 2015
2+
3+
Fix #346
4+
15
2.0.14 -- 13 Dec 2015
26

37
Fix #212

R/ggplotly.R

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -845,16 +845,18 @@ gg2list <- function(p) {
845845
not.merged <- not.merged[-1]
846846
# Are there any traces that have not yet been merged, and can be
847847
# merged with tr?
848-
can.merge <- rep(FALSE, l=length(not.merged))
848+
can.merge <- logical(length(not.merged))
849849
for(other.i in seq_along(not.merged)){
850850
other <- not.merged[[other.i]]
851851
criteria <- c()
852852
for(must.be.equal in c("x", "y", "xaxis", "yaxis")){
853853
other.attr <- other[[must.be.equal]]
854854
tr.attr <- tr[[must.be.equal]]
855-
criteria[[must.be.equal]] <- isTRUE(all.equal(other.attr, tr.attr))
855+
criteria[[must.be.equal]] <-
856+
isTRUE(all.equal(other.attr, tr.attr)) &&
857+
unique(other$type, tr$type) == "scatter"
856858
}
857-
if(all(criteria) && tr$type != "bar"){
859+
if(all(criteria)){
858860
can.merge[[other.i]] <- TRUE
859861
}
860862
}
@@ -866,7 +868,7 @@ gg2list <- function(p) {
866868
}, error=function(e){
867869
NA
868870
})
869-
if(is.character(new.mode) && !is.na(new.mode)){
871+
if(is.character(new.mode) && !is.na(new.mode %||% NA)){
870872
tr$mode <- new.mode
871873
}
872874
attrs <- c("error_x", "error_y", "marker", "line")
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
context("Density2d")
22

33
# Draw a 2d density estimation using geom_density2d
4-
m <- ggplot(MASS::geyser) + geom_density2d(aes(x=duration, y=waiting))
4+
m <- ggplot(MASS::geyser, aes(x=duration, y=waiting)) +
5+
geom_point(alpha = 0.4) +
6+
geom_density2d()
57
L <- save_outputs(m, "density2d")
68

79
test_that("geom_density2d is translated to type=histogram2dcontour", {
8-
expect_equal(length(L$data), 1)
9-
expect_identical(L$data[[1]]$type, "histogram2dcontour")
10+
expect_equal(length(L$data), 2)
11+
expect_identical(L$data[[2]]$type, "histogram2dcontour")
1012
})
1113

1214
test_that("geom_density2d uses line contours by default", {
13-
expect_identical(L$data[[1]]$contours$coloring, "lines")
15+
expect_identical(L$data[[2]]$contours$coloring, "lines")
1416
})

0 commit comments

Comments
 (0)