diff --git a/R/plotly.R b/R/plotly.R index 1882e22dc6..de89f3cb1f 100644 --- a/R/plotly.R +++ b/R/plotly.R @@ -218,8 +218,8 @@ plotly_build <- function(l = last_plot()) { for (i in seq_along(l$data)) { d <- l$data[[i]] # if appropriate, evaluate trace arguments in a suitable environment - idx <- names(d) %in% c("args", "env") - if (sum(idx) == 2) { + idx <- names(d) %in% c("args", "env", "enclos") + if (sum(idx) == 3) { dat <- c(d[!idx], eval(d$args, as.list(d$env), d$enclos)) dat[c("args", "env", "enclos")] <- NULL # start processing specially named arguments @@ -275,8 +275,8 @@ plotly_build <- function(l = last_plot()) { } for (i in seq_along(l$layout)) { layout <- l$layout[[i]] - idx <- names(layout) %in% c("args", "env") - x$layout[[i]] <- if (sum(idx) == 2) { + idx <- names(layout) %in% c("args", "env", "enclos") + x$layout[[i]] <- if (sum(idx) == 3) { c(layout[!idx], eval(layout$args, as.list(layout$env), layout$enclos)) } else { layout @@ -287,8 +287,8 @@ plotly_build <- function(l = last_plot()) { if (!is.null(l$style)) { for (i in seq_along(l$style)) { sty <- l$style[[i]] - idx <- names(sty) %in% c("args", "env") - new_sty <- if (sum(idx) == 2) c(sty[!idx], eval(sty$args, as.list(sty$env), sty$enclos)) else sty + idx <- names(sty) %in% c("args", "env", "enclos") + new_sty <- if (sum(idx) == 3) c(sty[!idx], eval(sty$args, as.list(sty$env), sty$enclos)) else sty for (k in sty$traces) x$data[[k]] <- modifyList(x$data[[k]], new_sty) } } diff --git a/R/plotly_POST.R b/R/plotly_POST.R index 549824fc53..3f49149905 100644 --- a/R/plotly_POST.R +++ b/R/plotly_POST.R @@ -31,10 +31,9 @@ plotly_POST <- function(x) { # empty keyword arguments can cause problems kwargs <- x[get_kwargs()] kwargs <- kwargs[sapply(kwargs, length) > 0] - + # filename & fileopt are keyword arguments required by the API # (note they can also be specified by the user) - if (!is.null(x$url) || !is.null(kwargs$filename)) kwargs$fileopt <- "overwrite" if (is.null(kwargs$filename)) { kwargs$filename <-