save_figures | R Documentation |
Systematically save your figures for your report
save_figures(
figure,
list_figures,
header = "",
footnotes = "",
filename0 = "x",
cnt_chapt_content = "001",
cnt = 1,
path = NULL,
width = 6,
height = 6,
output_type = c("pdf", "png"),
type = "Figure",
alttext = "",
filename_desc = "",
nickname = "",
raw = NULL,
message = FALSE
)
figure |
The figure you would like to be saved. |
list_figures |
The list where all figures will be saved. |
header |
The name and title of the figure. Default = "". |
footnotes |
Any footnote you want attached to this figure. |
filename0 |
The filename set at the begining of the chapter. |
cnt_chapt_content |
The order number that this exists in the chapter. |
cnt |
The figure number. |
path |
The path the file needs to be saved to. Default = "NULL", meaning it wont save anything and will override all other saving elements. |
width |
Default = 6 inches. |
height |
Default = 6 inches. |
output_type |
Default = c("pdf", "png"). Can be anything supported by ggsave(). |
type |
Default = "Figure", but can be anything that the element needs to be called (e.g., "Graphic", "Fig.", "Graph") to fit in the phrase "Figure 1. This is my plot!". |
alttext |
String with what the alternative text is. |
filename_desc |
Additional description text for the filename that will be added at the name of file before the filename extention. Can be use to add a species name, location, or anything else that would make it easier to know what that file shows. |
nickname |
A unique name that can be used to identify the figure so it can be referenced later in the report. |
raw |
Optional. The data.frame or other data that has no rounding and no dividing of numbers (good to save this for record keeping) and was used to create the figure. Default = NA. |
message |
TRUE/FALSE. Default = FALSE. If TRUE, it will print information about where your plot has been saved to. |
list_figures updated with the new plot and metadata.
library(magrittr)
library(ggplot2)
list_figures <- c()
dat <- data.frame(x = rnorm(n = 10),
y = rnorm(n = 10),
col = rep_len(x = c("a", "b"),
length.out = 5))
# Select data and make plot
figure<- dat %>%
ggplot(aes(x = x, y = y,
colour = as.factor(col))) + # create plot
geom_point()
list_figures<-save_figures(figure = figure,
list_figures = list_figures,
header = "example",
footnote = "footnote example")
names(list_figures)
list_figures
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.