multipanelfigure (version 2.1.2)

save_multi_panel_figure: 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 multipanelfigure/ gtable as produced by multi_panel_figure.

filename

Single character object representing file name/path to create on disk.

dpi

Single numeric indicating the plot resolution. Applies only to raster output types.

...

Other arguments passed to ggsave.

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).

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

Run this code
# NOT RUN {
# 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"))
# }

Run the code above in your browser using DataCamp Workspace