View source: R/Coxmos_plot_functions.R
save_ggplot_lst | R Documentation |
Allows to save a list of 'ggplot2' objects in .tiff format based on an specific resolution.
save_ggplot_lst(
lst_plots,
folder,
prefix = NULL,
suffix = NULL,
wide = TRUE,
quality = "4K",
dpi = 80,
format = "png",
custom = NULL,
object_name = NULL
)
lst_plots |
List of 'ggplot2' objects. |
folder |
Character. Folder path as character type. |
prefix |
Character. Prefix for file name. |
suffix |
Character. Sufix for file name. |
wide |
Logical. If TRUE, widescreen format (16:9) is used, in other case (4:3) format. |
quality |
Character. One of: "HD", "FHD", "2K", "4K", "8K" |
dpi |
Numeric. DPI value for the image. |
format |
Device to use. Can either be a device function (e.g. png), or one of "eps", "ps", "tex" (pictex), "pdf", "jpeg", "tiff", "png", "bmp", "svg" or "wmf" (windows only). |
custom |
Numeric vector. Custom size of the image. Numeric vector of width and height. |
object_name |
Character. If the file to plot it is inside of a list, name of the object to save. |
Generate a plot image in the specific folder or working directory.
Pedro Salguero Garcia. Maintainer: pedsalga@upv.edu.es
if(requireNamespace("ggplot2", quietly = TRUE)){
library(ggplot2)
data(iris)
g <- ggplot(iris, aes(Sepal.Width, Sepal.Length, color = Species))
g <- g + geom_point(size = 4)
g2 <- ggplot(iris, aes(Petal.Width, Petal.Length, color = Species))
g2 <- g2 + geom_point(size = 4)
lst_plots <- list("Sepal" = g, "Petal" = g2)
save_ggplot_lst(lst_plots, folder = tempdir())
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.