Skip to content

Commit ffb7ac9

Browse files
committed
fix #346
1 parent 5509909 commit ffb7ac9

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

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")

0 commit comments

Comments
 (0)