save_multi_panel_figure {multipanelfigure} | R Documentation |
save_multi_panel_figure
Description
A convenience function wrapping ggsave
from ggplot2 for easy saving of gtable
objects
constructed by multi_panel_figure
taking into account the
table's dimensions.
Usage
save_multi_panel_figure(figure, filename, dpi = 300, ...)
Arguments
figure |
Object of classes |
filename |
Single |
dpi |
Single |
... |
Other arguments passed to |
Details
Plot dimensions are determined using
figure_height
and figure_width
.
The Device type to use is guessed from the filename
extension.
Currently supported are "eps", "ps", "tex" (pictex), "pdf", "jpeg", "tiff",
"png", "bmp", "svg" or "wmf" (windows only).
Author(s)
Johannes Graumann
References
Graumann, J., and Cotton, R.J. (2018). multipanelfigure: Simple Assembly of Multiple Plots and Images into a Compound Figure. Journal of Statistical Software 84. doi: 10.18637/jss.v084.c03
See Also
ggsave
, figure_width
,
figure_height
Examples
# Create the figure layout
(figure <- multi_panel_figure(
width = c(30,40,60),
height = c(40,60,60,60),
panel_label_type = "upper-roman"))
# Fill the top-left panel using a grob object directly
a_grob <- grid::linesGrob(arrow = grid::arrow())
figure %<>% fill_panel(a_grob)
## Not run:
# Save the figure
figure %>%
save_multi_panel_figure(
filename = paste0(
tempfile(),
".png"))
## End(Not run)