gfig_saver | R Documentation |
Simplify plotting for larger projects by simultaneously saving the plot, documentation of the plot, and the ggplot object itself as an RDS file.
gfig_saver( filename, description, gfig = last_plot(), from.description = NULL, is.knitted = FALSE, width = 12, height = 8, res = 300, units = "in", ... )
filename |
Name of the file (can include filepath) WITHOUT FILETYPE. Function will automatically save pdf and jpg filetypes. |
description |
Description of the figure generated to save as metadata. It is useful to treat this as a prototype figure caption, but with any additional details on methods, specific parameters, etc. |
gfig |
Figure, defaults to the last plot displayed. |
from.description |
Optional additional description of where the figures were generated - the scripts and project. |
is.knitted |
If this function is being used in a knitted document, the knitr package can automatically save the script name in the description. Default is |
width |
Width of the saved figure; default is 12 inches. |
height |
Height of the saved figure; default is 8 inches. |
res |
Resolution of the saved figure; default is 300 dpi. |
units |
Units for height and with; default is inches. Options include "cm", "mm", and "px" |
... |
additional ggplot2 arguments |
none
library(ggplot2) x= 1:10 y = x + rnorm(10) dat = data.frame(x, y) gp = ggplot(data = dat, aes(x=x, y=y))+ geom_point() gfig_saver(filename="testfig", description=c("This is an example figure of X = Y + noise", "note that this is just for demonstration"), gfig = gp)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.