insert_animate | R Documentation |
Insert an animated plot into an R Markdown document
insert_animate(file, options = click_to_play(), style, use_cdn = TRUE)
file |
The exported plot. |
options |
A character string; the JavaScript to customise the playback options.
Two basic options |
style |
Optional style for the iframe that hosts the visualisation. |
use_cdn |
TRUE / FALSE; if TRUE, serve the assets from a CDN, otherwise embed the assets into the HTML. |
input <- tempfile(fileext = ".Rmd") output <- tempfile(fileext = ".html") writeLines(' ```{r, echo = FALSE, message = FALSE} # Run / include the following in a code chunk of an R Markdown document library(animate) insert_animate(system.file("tests/Lorenz_system.json.gz", package = "animate"), options = click_to_loop()) ``` ', input) knitr::knit(input, output) # browseURL(output)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.