export as plotly html (only support ggplot2 object)
tohtml(figure, filename = "temp.html", save = TRUE)
output figure function, set NULL output the current figure
output format (could be ingored)
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)
}
Run the code above in your browser using DataLab