#' Function for saving a plot (when it is not ggobject).
#'
#' @param file_name Name of file we want to see in directory. Default filename: "plot"
#' @param plot_name Name of plot we want to export.
#' @param width Width of exported plot. Default value: 13 inches
#' @param height Height of exported plot. Default value: 8 inches
#' @param dpi Default value: dpi = 150
save_plot_grid <- function(plot_name,
file_name = "plot",
width = 13,
height = 8,
dpi = 150) {
# pdf
pdf(paste0(file_name, ".pdf"), width = 13, height = 8)
grid.draw(plot_name)
dev.off()
# png
png(paste0(file_name, ".png"), width = 13, height = 8, units = "in", res = dpi)
grid.draw(plot_name)
dev.off()
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.