Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

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

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

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)

multipanelfigure

Infrastructure to Assemble Multi-Panel Figures (from Grobs)

v2.1.2
GPL (>= 3)
Authors
Johannes Graumann [cre, aut], Richard Cotton [ctb]
Initial release
2020-03-04

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.