Skip to content

Instantly share code, notes, and snippets.

@zeehio
Created January 30, 2019 07:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zeehio/521de08708870c24f5dca478a92818c5 to your computer and use it in GitHub Desktop.
Save zeehio/521de08708870c24f5dca478a92818c5 to your computer and use it in GitHub Desktop.
Save the plotly plot as html
#' Plots in WebGL
#' @param plt A plot created with plotly or ggplot2
#' @param html_filename The file name where the plot will be saved
#'
#' @return The html_filename
#' @export
#'
plot_interactive <- function(plt, html_filename) {
htmltools::save_html(
html = htmltools::as.tags(
x = plotly::toWebGL(plt),
standalone = TRUE),
file = html_filename)
html_filename
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment