File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -43,13 +43,15 @@ plotly_build.plotly <- function(p) {
43
43
44
44
# if an annotation attribute is an array, expand into multiple annotations
45
45
nAnnotations <- max(lengths(x $ annotations ) %|| % 0 )
46
- # font is the only list object, so store it, and attach after transposing
47
- font <- x $ annotations [[" font" ]]
48
- x $ annotations <- purrr :: transpose(lapply(x $ annotations , function (x ) {
49
- as.list(rep(x , length.out = nAnnotations ))
50
- }))
51
- for (i in seq_len(nAnnotations )) {
52
- x $ annotations [[i ]][[" font" ]] <- font
46
+ if (nAnnotations > 1 && ! is.null(names(x $ annotations ))) {
47
+ # font is the only list object, so store it, and attach after transposing
48
+ font <- x $ annotations [[" font" ]]
49
+ x $ annotations <- purrr :: transpose(lapply(x $ annotations , function (x ) {
50
+ as.list(rep(x , length.out = nAnnotations ))
51
+ }))
52
+ for (i in seq_len(nAnnotations )) {
53
+ x $ annotations [[i ]][[" font" ]] <- font
54
+ }
53
55
}
54
56
55
57
x [lengths(x ) > 0 ]
You can’t perform that action at this time.
0 commit comments