generate_pdf: Convert a list of ggplot objects into a (multi-page) PDF.

Description Usage Arguments Details Value Examples

Description

Given a list of ggplot objects - arrange the plots on a page (with a specified number of plots columns/rows per page) and save as a (multi-page) PDF

Usage

1
2
3
4
generate_pdf(ggplt_list, ncol_plot = 3, nrow_plot = 3, output_path,
  output_file, orientation = "vertical", share_legend = FALSE,
  quiet = FALSE, height_plot = NULL, width_plot = NULL,
  height_overall = NULL, width_overall = NULL)

Arguments

ggplt_list

List of ggplot objects (list - ggplot).

ncol_plot

Number of plot columns on each page of the final PDF (integer) [default: 3].

nrow_plot

Number of plot rows on each page of the final PDF (integer) [default: 3].

output_path

Path where the final PDF is to be saved ("...../") (character).

output_file

Namer under which the final PDF is to be saved ("...pdf") (character).

orientation

Page orientation of the final PDF (character - "vertical"/"horizontal") [default: "vertical"].

share_legend

Whether or not all plots on a page are to share one legend (logical - TRUE/FALSE) [default: FALSE].

quiet

Whether to print status updates as individual pages are generated (logical - TRUE/FALSE) [default: FALSE].

Details

Maintained by: Clara Marquardt

Value

Generate and save a PDF with all plots.

Examples

1
2
3
4
5
6
7
8
9
\{dontrun
plot_1 <- ggplot(data=dia[1:15]) + 
	geom_bar(aes(x=dia_code)) + 
	theme_basic()
plot_list <- list(plot_1, plot_1, plot_1, plot_1,plot_1, plot_1, plot_1)
generate_pdf(ggplt_list=plot_list, ncol_plot=3, nrow_plot=2, 
 output_path="", output_file="merge_pdf_test", orientation="horizontal", 
 share_legend=FALSE, quiet=FALSE) 
}

ClaraMarquardt/ehR documentation built on May 6, 2019, 12:02 p.m.