@@ -218,8 +218,8 @@ plotly_build <- function(l = last_plot()) {
218
218
for (i in seq_along(l $ data )) {
219
219
d <- l $ data [[i ]]
220
220
# if appropriate, evaluate trace arguments in a suitable environment
221
- idx <- names(d ) %in% c(" args" , " env" )
222
- if (sum(idx ) == 2 ) {
221
+ idx <- names(d ) %in% c(" args" , " env" , " enclos " )
222
+ if (sum(idx ) == 3 ) {
223
223
dat <- c(d [! idx ], eval(d $ args , as.list(d $ env ), d $ enclos ))
224
224
dat [c(" args" , " env" , " enclos" )] <- NULL
225
225
# start processing specially named arguments
@@ -275,8 +275,8 @@ plotly_build <- function(l = last_plot()) {
275
275
}
276
276
for (i in seq_along(l $ layout )) {
277
277
layout <- l $ layout [[i ]]
278
- idx <- names(layout ) %in% c(" args" , " env" )
279
- x $ layout [[i ]] <- if (sum(idx ) == 2 ) {
278
+ idx <- names(layout ) %in% c(" args" , " env" , " enclos " )
279
+ x $ layout [[i ]] <- if (sum(idx ) == 3 ) {
280
280
c(layout [! idx ], eval(layout $ args , as.list(layout $ env ), layout $ enclos ))
281
281
} else {
282
282
layout
@@ -287,8 +287,8 @@ plotly_build <- function(l = last_plot()) {
287
287
if (! is.null(l $ style )) {
288
288
for (i in seq_along(l $ style )) {
289
289
sty <- l $ style [[i ]]
290
- idx <- names(sty ) %in% c(" args" , " env" )
291
- new_sty <- if (sum(idx ) == 2 ) c(sty [! idx ], eval(sty $ args , as.list(sty $ env ), sty $ enclos )) else sty
290
+ idx <- names(sty ) %in% c(" args" , " env" , " enclos " )
291
+ new_sty <- if (sum(idx ) == 3 ) c(sty [! idx ], eval(sty $ args , as.list(sty $ env ), sty $ enclos )) else sty
292
292
for (k in sty $ traces ) x $ data [[k ]] <- modifyList(x $ data [[k ]], new_sty )
293
293
}
294
294
}
0 commit comments