save_stacked_plots: Save dye screen plots with sensible dimensions and...

View source: R/save_dye_screen_figs.R

save_stacked_plotsR Documentation

Save dye screen plots with sensible dimensions and informative names.

Description

Save dye screen plots with sensible dimensions and informative names.

Usage

save_stacked_plots(
  .plot_list,
  .figure_titles,
  .plot_heights,
  .default_width = 10,
  .default_title_height = 0.5,
  .use_common_legend = TRUE,
  .common_legend_position = "top",
  .override_fig_title = FALSE,
  .override_save_width = FALSE,
  .override_save_height = FALSE,
  .override_plot_heights = FALSE,
  save_fig = FALSE,
  .save_path = "",
  .save_suffix = "dye_screen_results",
  .graphics_device = "pdf",
  .manual_fig_title = "Manual figure title",
  .manual_save_width = 10,
  .manual_save_height = 10,
  .manual_plot_heights = c(1, 1, 1),
  ...
)

Arguments

.plot_list

a list, containing plot objects created by ggplot2, in the order in which they will appear in the final figure. Typically, these are the output of the plot_dye_screen() function.

.figure_titles

a names list of two elements, typically, but not necessarily, created using the make_figure_title() function.

  • print a string, providing the title which will be added to the output figure.

  • save a string, providing the name under which the output figure will be saved. A directory can be specified either in this name, or using the .save_path argument in this function.

.plot_heights

a numeric vector, determining the heights of each of the plots provided in .plot_list, in the final figure.

.default_width

a number, diving the width of the plots in the final figure. Defaults to 10. (unit: inches)

.default_title_height

a number, giving the number of inches to be added to the final figure to accomodate the plot title.

.use_common_legend

a boolean, determining whether a single legend should be displayed for the figure in cases where multiple plots in .plot_list share identical legends. Defaults to TRUE.

.common_legend_position

a string, giving the position within the figure for the common legend to appear. Defaults to "top". Is passed directly to 'legend' argument of the ggpubr::ggarrange() function.

.override_fig_title

a boolean, which, if TRUE, overrides the automatically-generated figure title with the string provided to the '.manual_fig_title' argument of this function. Defaults to FALSE.

.override_save_width

a boolean, which, if TRUE, overrides the automatically-generated width of the saved figure with the number provided to the'.manual_save_width' argument of this function. Defaults to FALSE.

.override_save_height

a boolean, which, if TRUE, overrides the automatically-generated height of the final saved figure, with the number provided to the'.manual_save_height' argument of this function. Defaults to FALSE.

.override_plot_heights

a boolean, which, if TRUE, overrides the hieghts given in the .plot_heights argument to this function. Is useful for overriding .plot_heights values which may be passed automatically from upstream functions to this one in longer workflows. Replaces with the numeric vector provided to the'.manual_plot_heights' argument of this function. Defaults to FALSE.

save_fig

a boolean which, if TRUE, results in the final plot generataed in this function being saved.

.save_path

a string which, if present, is appended to the beginning of the save path, determining the directory into which the output plot will be saved. No trailing '/' necessary; e.g. to save into the directory which can be accessed from the current working directory via "results/plots/<figure_name>", provide "results/plots"

.save_suffix

a string, giving a suffix to append to the name of the saved plot. e.g. "dye_screen_results" or "hits_by_channel". This string is the last element of the saved name to appear before the file extension, and the main way to differentiate different plots made for the same dye screen.

.graphics_device

a string, giving the extension of the graphics device used to save the final plot using the ggsave() function. No period necessary; defaults to "pdf". Is pasted onto to the saved file name directly following the string provided to .save_suffix.

.manual_fig_title

a string which, if .override_fig_title is set to TRUE, will appear as the title of the saved figure.

.manual_save_width

a number which, if .override_save_width is set to TRUE, will be passed directly to the 'width' argument of the ggsave() function, determining the width of the saved figure.

.manual_save_height

a number which, if .override_save_height is set to TRUE, will be passed directly to the 'height' argument of the ggsave() function, determining the height of the saved figure.

.manual_plot_heights

a numeric vector with the same lengths as .plot_list, which, if .override_plot_heights is set to TRUE, will be passed directly to ggarrange to set the heights of each plot within the figure.

...

additional arguments, which are not passed to anything within this function at this time.

Value

a saved plot


taiawu/dsfworld_package documentation built on June 18, 2024, 5:39 a.m.