save_model_figure: Save a figure displaying raw data, fits, and tmas. Use...

View source: R/save_dye_screen_model_plots.R

save_model_figureR Documentation

Save a figure displaying raw data, fits, and tmas. Use reasonable dimensions.

Description

A wrapper function for adding facets, calculating dimenstions, and saving with a consistent name. In a better version of this function, would likely be refactored alongside plot_with_preds() and plot_analyzed_hits(). Calls on save_stacked_plot() to do so.

Usage

save_model_figure(
  tidied_for_tmas,
  by_var_fit,
  tidied_screen,
  hits_by_channel,
  extract_figure_title = TRUE,
  extract_layout_from_tidied = TRUE,
  extract_tmas_from_by_var_fit = TRUE,
  layout = NULL,
  model_tmas = NULL,
  .well_col_layout = "variable",
  .grid_margin_ratio = 215/110,
  ...
)

Arguments

tidied_for_tmas

a grouped, nested tibble, as returned by tidy_for_tmas

by_var_fit

a tibble, as output by add_model_fits.

tidied_screen

a tibble, as returned by tidy_dye_screen()

hits_by_channel

a tibble containing hit assignments, as expected by pull_assigned()

extract_figure_title

a boolean; if TRUE, both saved name and plot title are extracted from the given data via make_figure_title()

extract_layout_from_tidied

a boolean; if TRUE, the experimental layout is extracted from tidied_screen via extract_plate_layout, and the unique-identifier column of the output layout is named ".var"

extract_tmas_from_by_var_fit

a boolean; if TRUE, the tmas applied to the plots are extracted directly from by_var_fit. This is usually done in a single operation, and it's not clear exactly why one would set this to FALSE unless avoid that additional operation was important, and the model tma values had already been calculated and stored elsewhere.

layout

if extract_layout_from_tidied is FALSE, a tibble containig a layout, as returned by read_plate_layout or extract_plate_layout. Gets passed to tidy_for_plot() in this function.

model_tmas

if extract_tmas_from_by_var_fit is FALSE, a tibble containing the extracted model tmas, formatted to match the output of extract_model_tmas().

.well_col_layout

a string, giving the name of the column containing well names in tidied_for_tmas, which is renamed ".var" if extract_layout_from_tidied = TRUE.

.grid_margin_ratio

a number, passed to convert_heights(), estimating the height ratio between a full panel (including, e.g. axis ticks and labels), and the fixed panel size.

...

additional named parameters, passed to the functions: extract_plate_layout(), join_with_preds(), tidied_for_plot(), plot_analyzed_hits(), force_panel_sizing(), and save_stacked_plots()

Value

if assigned, the final figure object. regardless of assignment, a saved figure, with names, directories, and file types as dictated by save_stacked_plots(). Uses save_stacked_plots() defaults, unless these arguments are overwritten by passing new named values for them to this function.


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