plot_with_preds: Plot raw and predicted data together, with Tmas

View source: R/save_dye_screen_model_plots.R

plot_with_predsR Documentation

Plot raw and predicted data together, with Tmas

Description

use plot_with_preds to generate a plot displaying the results of model fitting. In a better version of this function, would likely be refactored alongside its wrappers, plot_analyzed_hits() and save_model_figure().

Usage

plot_with_preds(
  raw_and_pred,
  tma_df,
  .var_col = ".var",
  .var_which_val_col = ".var_which_val",
  .which_value_col = "which_value",
  .model_name_col = "model_name",
  .Temperature_norm_col = "Temperature_norm",
  .value_col = "value",
  .tma_col = "tma",
  .fill_scale = c(sigmoid_1 = "#4AA267", sigmoid_2 = "#4AA267", sigmoid_3 = "#4AA267",
    initial_1 = "darkgrey"),
  .point_size = 0.1,
  .point_alpha = 0.2,
  .point_color = "black",
  .pred_line_color = "black",
  .vline_color = "black",
  .vline_size = 0.2,
  .line_size = 0.3,
  .line_alpha = 0.8,
  .ribbon_alpha = 0.3,
  .ribbon_color = NA,
  ...
)

Arguments

raw_and_pred

a tibble, as returned by join_with_preds

tma_df

a tibble, as returend by extract_model_tmas

.var_col

a string, giving the name of the column in both tidy_for_tmas and by_var_fit giving identical unqiue identifiers fo a given dataset. Defaults to ".var"

.var_which_val_col

a string, giving the name of the column in raw_and_pred which further specifies the unique datasets into individaul value types, e.g. "A1_FAM_raw", "A1_FAM_sigmoid_1", etc. Passed to ggplot(aes(group = )), to define unique datasets for all geoms used in this plot.

.which_value_col

a string, giving the name of the column in raw_and_pred giving the value type–e.g. "sigmoid_1", "sigmoid_2", etc. Passed to aes(fill = ) argument of geom_ribbon; used to shade the reconstructed sigmoids and reconstructed initial fluroescence omponents differently.

.model_name_col

a string, giving the name of column in raw_and_pred which gives the name of the fitted model, e.g. "model_1". Defaults to "model_name".

.Temperature_norm_col

a string, giving the name of the column in raw_and_pred containing normalized Temperatures. Used as the x values / x axis in the returned plot.

.value_col

a string, giving the name of the column in raw_and_pred containing y values, regardless of value type. Used as the y axis / y values in the returned plot.

.tma_col

a string, giving the name of the column in tma_df ctaining the apparent melting temperatures extracted from the fits. Note that these must correspond to the normalized Temperature, unless the predictions and raw data have been mapped onto raw Temperature before the creation of this plot.

.fill_scale

a named character vector, passed directly to the values argument of scale_color_manual. Determines the shading colors used in the reconstructed fit components. Defaults to c("sigmoid_1" = "#4AA267", "sigmoid_2" = "#4AA267", "sigmoid_3" = "#4AA267", "initial_1" = "darkgrey")

.point_size

a number, passed to geom_point(size = ), the geom used to display the raw data. Defaults to 0.1

.point_alpha

a number, passed to geom_point(alpha = ), the geom used to display the raw data. Defaults to 0.2.

.point_color

a string of a quoted color name, passed to geom_point(color = ), the geom used to display the raw data. Defaults to "black".

.pred_line_color

a string of a quoted color name, passed to geom_line(color = ), the geom used to display the full model prediction. Defaults to "black".

.vline_color

a string of a quoted color name, passed to geom_vline(color = ), the geom used to display tmas. Defaults to "black"

.vline_size

a number, passed to geom_vline(size = ), the geom used to display tmas. Defaults to 0.2

.line_size

a number, passed to geom_line(size = ), the geom used to display the full model prediction. Defaults to 0.3

.line_alpha

a number, passed to geom_line(alpha = ), the geom used to display the full model prediction. Defaults to 0.8

.ribbon_alpha

a number, passed to geom_ribbon(alpha = ), the geom used to display the individual reconstructed model components. Defaults to 0.3

.ribbon_color

a string of a quoted color name, passed to geom_ribbon(color = ), the geom used to display the full model prediction. Defaults to NA, but if assigned, will appear as a line on the top of the shaded regions.

...

additional arguments, not passed to anything internal here, but allows for the function to recieve named arguments from upstream functions while ignoring arguments passed with ... which match nothing in this function. IN a better version of this function, these arguments be passed to theme_screen_austere() within this function.

Value

a minimal ggplot2 plot object for the given data, without faceting, fixed dimensions, or cutom labels.


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