save_plots_to_pdf {RNAseqQC}R Documentation

Save list of plots to PDF

Description

This function takes a list of plots as input and makes a pdf with ncol x nrow plots per page.

Usage

save_plots_to_pdf(
  plots,
  file = "plots.pdf",
  ncol,
  nrow,
  subfig_width = subfig_height * 16/9,
  subfig_height = 2.5,
  legend_position = "original"
)

Arguments

plots

List of plots that is passed to the plotlist argument of cowplot::plot_grid

file

file where the plots are saved

ncol

number of columns per page for the grid of plots

nrow

number of rows per page for the grid of plots

subfig_width

width of a plot of the grid in inches

subfig_height

height of a plot of the grid in inches

legend_position

either 'original' if the original legend of each sub-plot is shown, 'none', if no legend should be shown in any of the sub-plots, 'bottom', if no legend should be shown in the sub plots and one shared legend at the bottom or 'right', which is same as 'bottom', but shown on the right

Value

The function returns nothing but is called for it's side effect, which is to save a pdf of plots to the filesystem.

Examples


library("ggplot2")
manuf <- unique(mpg$manufacturer)
plots <- lapply(manuf, function(x){
  df <- mpg[mpg$manufacturer==x,]
  ggplot(df, aes(cty, hwy)) +
    geom_point() +
    labs(title=x)
})
save_plots_to_pdf(plots, ncol=3, nrow=2)



[Package RNAseqQC version 0.2.1 Index]