Skip to content

Commit 92c3ac4

Browse files
committed
Move annotation boxing to plotly_build() so it works for offline mode
1 parent e883b0b commit 92c3ac4

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

R/plotly.R

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,11 @@ plotly_build <- function(l = last_plot()) {
309309
idx <- names(d) %in% get_boxed() & sapply(d, length) == 1
310310
if (any(idx)) x$data[[i]][idx] <- lapply(d[idx], I)
311311
}
312+
# ugh, annotations _must_ be an _array_ of object(s)...
313+
a <- x$layout$annotations
314+
if (!is.null(a) && !is.null(names(a))) {
315+
x$layout$annotations <- list(x$layout$annotations)
316+
}
312317
# search for keyword args in traces and place them at the top level
313318
kwargs <- lapply(x$data, function(z) z[get_kwargs()])
314319
if (length(kwargs) == 1) kwargs <- c(kwargs, kwargs)

R/plotly_POST.R

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,6 @@ plotly_POST <- function(x) {
4848
"plot from api"
4949
}
5050
if (is.null(kwargs$fileopt)) kwargs$fileopt <- "new"
51-
# ugh, annotations _must_ be an _array_ of object(s)...
52-
a <- kwargs$layout$annotations
53-
if (!is.null(a) && !is.null(names(a))) {
54-
kwargs$layout$annotations <- list(kwargs$layout$annotations)
55-
}
5651
# construct body of message to plotly server
5752
bod <- list(
5853
un = verify("username"),

0 commit comments

Comments
 (0)