Skip to content

Commit 260df21

Browse files
committed
respect showlegend set in layers2traces
1 parent e726775 commit 260df21

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

R/ggplotly.R

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,10 @@ gg2list <- function(p, width = NULL, height = NULL, mapping = "all", source = "A
242242
})
243243
# show only one legend entry per legendgroup
244244
grps <- sapply(traces, "[[", "legendgroup")
245-
traces <- Map(function(x, y) { x$showlegend <- y; x}, traces, !duplicated(grps))
245+
traces <- Map(function(x, y) {
246+
x$showlegend <- isTRUE(x$showlegend) && y
247+
x
248+
}, traces, !duplicated(grps))
246249

247250
# ------------------------------------------------------------------------
248251
# axis/facet/margin conversion

0 commit comments

Comments
 (0)