Skip to content

Commit 724b440

Browse files
committed
don't traceify by non-existant levels
1 parent f0364cb commit 724b440

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

R/plotly_build.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,7 @@ map_linetype <- function(traces) {
658658
traceify <- function(dat, x = NULL) {
659659
if (length(x) == 0) return(list(dat))
660660
lvls <- if (is.factor(x)) levels(x) else unique(x)
661+
lvls <- lvls[lvls %in% x]
661662
# the order of lvls determines the order in which traces are drawn
662663
# for ordered factors at least, it makes sense to draw the highest level first
663664
# since that _should_ be the darkest color in a sequential pallette

0 commit comments

Comments
 (0)