Skip to contents

Plots calibration curves for each measured feature.

Usage

plot_calibrationcurves(
  data = NULL,
  variable = "intensity",
  overwrite_metadata = FALSE,
  fit_method = c("linear", "quadratic"),
  fit_weighting = c(NA, "none", "1/x", "1/x^2"),
  log_axes = FALSE,
  filter_data = FALSE,
  output_pdf = FALSE,
  include_feature_filter = "",
  exclude_feature_filter = "",
  max_regression_value = NA,
  path = "",
  rows_page = 4,
  cols_page = 5,
  specific_page = NA,
  point_size = 1.5,
  line_width = 0.7,
  scaling_factor = 1,
  page_orientation = "LANDSCAPE",
  font_base_size = 7,
  show_progress = TRUE,
  return_plots = FALSE
)

Arguments

data

A MidarExperiment object .

variable

The variable name to plot on the y-axis, usually a measure of intensity. Defaults to "intensity"

overwrite_metadata

A logical value (TRUE or FALSE). If TRUE, the function will ignore any fit method and weighting settings defined in the metadata and use the provided fit_method and fit_weighting values for all analytes.

fit_method

A character string specifying the default regression fit method to use for the calibration curve. Must be one of "linear" or "quadratic". This method will be applied if no specific fit method is defined for a feature in the metadata.

fit_weighting

A character string specifying the default weighting method for the regression points in the calibration curve. Must be one of "none", "1/x", or "1/x^2". This method will be applied if no specific weighting method is defined for a feature in the metadata.

log_axes

Logical. If TRUE, the x and y axes are displayed in logarithmic scale. Defaults to FALSE.

filter_data

Logical. Indicates whether to use quality control (QC) filtered data (TRUE) or the raw data (FALSE). Defaults to FALSE.

output_pdf

Logical. If TRUE, saves the generated plots as a PDF file. Defaults to FALSE.

include_feature_filter

A regex pattern to filter and include features that match the criteria. If omitted, all features are considered.

exclude_feature_filter

A regex pattern to filter and exclude features that match the criteria. If omitted, no features are excluded.

max_regression_value

The maximum x value (analyzed amount) for which the regression line is fitted. Defaults to NA, considering all data points.

path

The file path for saving the PDF. Defaults to an empty string, meaning no file is saved.

rows_page

The number of rows of plots per page for the PDF output. Defaults to 4.

cols_page

The number of columns of plots per page for the PDF output. Defaults to 5.

specific_page

An integer specifying a particular page to plot. If NA, all pages are plotted.

point_size

Numeric value specifying the size of points in the plot. Defaults to 1.5.

line_width

Numeric value specifying the width of regression lines. Defaults to 0.7.

scaling_factor

A universal scaling factor for fonts, symbols, and lines. Defaults to 1.

page_orientation

The orientation of the PDF paper, either "LANDSCAPE" or "PORTRAIT". Defaults to "LANDSCAPE".

font_base_size

The base font size for text in the plots. Defaults to 7.

show_progress

Logical. Show a progress bar during plot creation if set to TRUE. Defaults to TRUE.

return_plots

Logical. If TRUE, returns the plots as a list of ggplot2 objects. Each item represents a page of plots. Defaults to FALSE.

Value

If return_plots is TRUE, a list of ggplot2 objects is returned. Otherwise, the function may return a plot output and/or save a PDF, depending on the output_pdf parameter.