Create a Run Scatter Plot to Visualize Analyte Distributions
Source:R/plots-qc-runorder.R
plot_runscatter.Rd
The run scatter plot allows you to visualize the sequence of measurements and distribution of QC (sample) types across the analysis run sequence. This can be useful for identifying trends, outliers, or other patterns in the data.
The function provides a range of options for customizing the plot, such as:
Filtering the data (e.g., by QC type, feature ID)
Applying outlier capping
Displaying batch information and control limits
Showing trend lines for drift correction
Controlling the layout and appearance of the plot
Usage
plot_runscatter(
data = NULL,
variable = c("intensity", "norm_intensity", "conc", "conc_raw", "area", "height",
"fwhm"),
filter_data = FALSE,
qc_types = NA,
include_qualifier = TRUE,
include_feature_filter = NA,
exclude_feature_filter = NA,
plot_range_indices = NA,
output_pdf = FALSE,
path = "",
log_scale = FALSE,
cap_outliers = FALSE,
cap_qc_k_mad = 4,
cap_spl_k_mad = 4,
cap_top_n_values = NA,
show_batches = TRUE,
show_control_limits = NA,
set_limits_n_sd = NA,
limits_batchwise = FALSE,
limits_linecolor = "#38dff5",
limits_linewidth = 0.75,
batches_as_shades = FALSE,
batch_line_color = "#b6f0c5",
batch_shading_color = "grey93",
cols_page = 3,
rows_page = 3,
base_font_size = 11,
annot_scale = 1,
show_trend = FALSE,
trend_linecolor = "#22e06b",
fit_qc_type = "BQC",
page_orientation = "LANDSCAPE",
point_transparency = 1,
point_size = 2,
point_border_width = 1,
specific_page = NA,
y_label_text = NA,
return_plots = FALSE,
show_gridlines = FALSE,
show_progress = FALSE
)
Arguments
- data
MidarExperiment object
- variable
Variable to plot, one of 'area', 'height', 'intensity', 'norm_intensity', 'intensity_raw', 'norm_intensity_raw', 'response', 'conc', 'conc_raw', 'rt', 'fwhm.'
- filter_data
Logical, whether to use QC-filtered data based on criteria set via
filter_features_qc()
- qc_types
QC types to be shown. Can be a vector of QC types or a regular expression pattern.
NA
(default) displays all available QC/Sample types.- include_qualifier
Logical, whether to include qualifier features
- include_feature_filter
Regex pattern to select features by feature_id.
NA
or""
ignores the filter.- exclude_feature_filter
Regex pattern to exclude features by feature_id.
NA
or""
ignores the filter.- plot_range_indices
Numeric vector of length 2, specifying the start and end indices of the sequence to be plotted.
NA
plots all samples.- output_pdf
Logical, whether to save the plot as a PDF file
- path
File name for the PDF output
- log_scale
Logical, whether to use a log10 scale for the y-axis
- cap_outliers
Logical, whether to cap upper outliers based on MAD fences of SPL and QC samples
- cap_qc_k_mad
Numeric, k * MAD (median absolute deviation) for outlier capping of QC samples
- cap_spl_k_mad
Numeric, k * MAD (median absolute deviation) for outlier capping of SPL samples
- cap_top_n_values
Numeric, cap the top n values regardless of MAD fences.
NA
or0
ignores this filter.- show_batches
Logical, whether to show batch separators in the plot
- show_control_limits
Logical, whether to show the mean line for the specified QC types.
NA
ignores the mean line.- set_limits_n_sd
Numeric, show +/- n x SD lines for the QC types defined in
show_control_limits
.NA
ignores the SD lines.- limits_batchwise
Logical, whether to calculate the mean and SD lines per batch
- limits_linecolor
Color of the mean and SD lines
- limits_linewidth
Width of the mean and SD lines
- batches_as_shades
Logical, whether to show batches as shaded areas instead of line separators
- batch_line_color
Color of the batch separator lines
- batch_shading_color
Color of the batch shaded areas
- cols_page
Number of columns per page
- rows_page
Number of rows per page
- base_font_size
Base font size for the plot
- annot_scale
Scale factor for text elements
- show_trend
Logical, whether to show a drift correction trend line
- trend_linecolor
Color of the trend line
- fit_qc_type
QC type used for smoothing the trend line
- page_orientation
Page orientation, "LANDSCAPE" or "PORTRAIT"
- point_transparency
Alpha transparency of the data points
- point_size
Size of the data points
- point_border_width
Width of the data point borders
- specific_page
Integer, show/save a specific page number.
NA
plots/saves all pages.- y_label_text
Override the default y-axis label text
- return_plots
Logical, whether to return the list of ggplot objects
- show_gridlines
Logical, whether to show major x and y gridlines
- show_progress
Logical, whether to show a progress bar