As a quality control measure to detect plates with inconsistent results or drift in calibration over time, this function plots standard curves for a specified analyte across multiple plates on a single plot. It enables visual comparison of standard curves, making it easier to spot outliers or shifts in calibration. The function can be run standalone or used as part of a broader Levey-Jennings report.
Each curve represents one plate, and users can choose how colours are applied — either in a monochromatic blue gradient (indicating time-based drift) or with distinct hues for clearer differentiation.
plot_standard_curve_stacked(
list_of_plates,
analyte_name,
data_type = "Median",
decreasing_dilution_order = TRUE,
monochromatic = TRUE,
legend_type = NULL,
plot_legend = TRUE,
legend_position = "bottom",
max_legend_items_per_row = 3,
legend_text_size = 6,
sort_plates = TRUE,
log_scale = c("all"),
separate_legend = FALSE,
verbose = TRUE
)ggplot object with the plot
list of Plate objects
Name of the analyte of which standard curves we want to plot.
Data type of the value we want to plot - the same
datatype as in the plate file. By default equals to Median
If TRUE the dilution values are
plotted in decreasing order, TRUE by default
If TRUE the color of standard curves changes
from white (the oldest) to blue (the newest) it helps to observe drift in
calibration of the device; otherwise, more varied colours are used, TRUE by default
default value is NULL, then legend type is determined
based on monochromatic value. If monochromatic is equal to TRUE then legend
type is set to date, if it is FALSE then legend
type is set to plate_name. User can override this behavior by
setting explicitly legend_type to date or plate_name.
If TRUE the legend is plotted, TRUE by default
the position of the legend, a possible values are c(right, bottom, left, top, none). Is not used if plot_legend equals to FALSE.
Maximum number of legend items per row when legend is at top or bottom. Default is 3.
Font size of the legend. Can be useful if plotting long plate names. Default is 8
(logical(1)) if TRUE sorts plates by the date of examination.
Which elements on the plot should be displayed in log scale.
By default "all". If NULL or c() no log scale is used,
if "all" or c("dilutions", "MFI") all elements are displayed in log scale.
If TRUE, the legend is returned as concatatenated ggplot object.
If TRUE prints messages, TRUE by default
The function overlays all standard curves from the provided plates for the given analyte.
When monochromatic = TRUE, the curves are drawn in a blue gradient — oldest plates in light blue (almost white) and most recent ones in dark blue.
This visual encoding helps track drift in calibration over time.
When monochromatic = FALSE, colours are selected from a hue palette to ensure distinct appearance,
especially useful when comparing many plates simultaneously.
The legend_type determines how curves are identified in the legend. By default, it adapts based on the monochromatic setting.
If the legend becomes crowded (e.g., with long plate names), use max_legend_items_per_row and legend_text_size to improve layout and readability.
# creating temporary directory for the example
output_dir <- tempdir(check = TRUE)
dir_with_luminex_files <- system.file("extdata", "multiplate_reallife_reduced",
package = "SerolyzeR", mustWork = TRUE
)
list_of_plates <- process_dir(dir_with_luminex_files,
return_plates = TRUE, format = "xPONENT", output_dir = output_dir
)
plot_standard_curve_stacked(list_of_plates, "ME", data_type = "Median", monochromatic = FALSE)
Run the code above in your browser using DataLab