#' write_plot
#'
#' write a plot
#'
#' @param outfile output filename
#' @param pattern pattern in the filename
#' @param plot_ plot
#'
#' @return
#' @export
#' @import ggplot2
#'
#' @examples
write_plot <- function(outfile, pattern="", plot_) {
dirname_ <- dirname(outfile)
basename_ <- basename(outfile)
outname <- paste0(basename_, pattern)
outfile <- paste(dirname_, outname, sep="/")
write(sprintf("Writing image plot: %s...", outfile), stderr())
ggsave(outfile, plot = plot_)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.