plot_standard_curve_stacked {SerolyzeR} | R Documentation |
Standard curve stacked plot for levey-jennings report
Description
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.
Usage
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 = 8,
sort_plates = TRUE,
log_scale = c("all"),
verbose = TRUE
)
Arguments
list_of_plates |
list of Plate objects |
analyte_name |
Name of the analyte of which standard curves we want to plot. |
data_type |
Data type of the value we want to plot - the same
datatype as in the plate file. By default equals to |
decreasing_dilution_order |
If |
monochromatic |
If |
legend_type |
default value is |
plot_legend |
If |
legend_position |
the position of the legend, a possible values are |
max_legend_items_per_row |
Maximum number of legend items per row when legend is at top or bottom. Default is 3. |
legend_text_size |
Font size of the legend. Can be useful if plotting long plate names. Default is 8 |
sort_plates |
( |
log_scale |
Which elements on the plot should be displayed in log scale.
By default |
verbose |
If |
Details
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.
Value
ggplot object with the plot
Examples
# 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)