if (FALSE) {
# Save a single image
p <- plot_ly(x = 1:10)
tmp <- tempfile(fileext = ".png")
save_image(p, tmp)
file.show(tmp)
# Efficiently save multiple images
scope <- kaleido()
for (i in 1:5) {
scope$transform(p, tmp)
}
# Remove and garbage collect to remove
# R/Python objects and shutdown subprocesses
rm(scope); gc()
}
Run the code above in your browser using DataLab