tohtml | R Documentation |
export as plotly html (only support ggplot2 object)
tohtml(figure, filename = "temp.html", save = TRUE)
figure |
output figure function, set NULL output the current figure |
filename |
output format (could be ingored) |
save |
save figure or not (default: TRUE) |
Kai Guo
if(interactive()){ require(ggplot2) p <- ggplot(mtcars, aes(mpg, disp, color = factor(cyl))) + geom_point() tohtml(p,filename = file.path(tempdir(), "mtcars.html")) ## or use ggplot directly ggplot(mtcars, aes(mpg, disp, color = factor(cyl))) + geom_point() tohtml(save = FALSE) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.