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) {
4343
4444 # if an annotation attribute is an array, expand into multiple annotations
4545 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+ }
5355 }
5456
5557 x [lengths(x ) > 0 ]
You can’t perform that action at this time.
0 commit comments