@@ -218,8 +218,8 @@ plotly_build <- function(l = last_plot()) {
218218 for (i in seq_along(l $ data )) {
219219 d <- l $ data [[i ]]
220220 # 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 ) {
223223 dat <- c(d [! idx ], eval(d $ args , as.list(d $ env ), d $ enclos ))
224224 dat [c(" args" , " env" , " enclos" )] <- NULL
225225 # start processing specially named arguments
@@ -275,8 +275,8 @@ plotly_build <- function(l = last_plot()) {
275275 }
276276 for (i in seq_along(l $ layout )) {
277277 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 ) {
280280 c(layout [! idx ], eval(layout $ args , as.list(layout $ env ), layout $ enclos ))
281281 } else {
282282 layout
@@ -287,8 +287,8 @@ plotly_build <- function(l = last_plot()) {
287287 if (! is.null(l $ style )) {
288288 for (i in seq_along(l $ style )) {
289289 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
292292 for (k in sty $ traces ) x $ data [[k ]] <- modifyList(x $ data [[k ]], new_sty )
293293 }
294294 }
0 commit comments