save_a4: Save a ggplot as an A4 image

View source: R/file_tools.R

save_a4R Documentation

Save a ggplot as an A4 image

Description

The dimensions are for the pixel size of an A4 page at 300 DPI. This is appropriate for inserting into Word without much detail loss, and with appropriate text and element sizes.

Usage

save_a4(path, basename, plot = ggplot2::last_plot(), portrait = FALSE)

Arguments

path

(Character) The output folder. It will be created if it does not exist. One sub-directory (⁠/png/⁠) will also be created if it doesn't exist.

basename

(Character) Basename of the image, without path or extension. Always saved as a .png.

plot

(ggplot) The plot object to save. By default, saves the most recent ggplot.

portrait

(Logical) FALSE by default, which outputs in landscape. If TRUE, flips the page dimensions to output in portrait.

Value

Returns TRUE invisibly if successful.

Examples

# qplot(mpg, wt, data = mtcars)
# save_a4("_test", "x_mpg y_wt")

#> Wrote 'ggplot2::last_plot' to '_test/png/x_mpg y_wt.png'.


DesiQuintans/desiderata documentation built on April 9, 2023, 5:43 a.m.