Plots chromatograms as a mirror plot.
Usage
mirror_plot(
x,
chrom_list,
lambdas = NULL,
var,
subset = NULL,
print_legend = TRUE,
legend_txt = NULL,
legend_pos = "topright",
legend_size = 1,
mirror = TRUE,
xlim = NULL,
ylim = NULL,
...
)Arguments
- x
The peak table (output from
get_peaktable).- chrom_list
A list of chromatograms in matrix format (timepoints × wavelengths). If no argument is provided here, the function will try to find the
chrom_listobject used to create thepeak_table.- lambdas
The wavelength(s) at which to plot the traces. Required for multi-wavelength chromatograms; ignored for one-dimensional chromatograms.
- var
Name of the column in the sample metadata that defines the two groups.
- subset
Character vector of the two levels of
varto compare. Required ifvarhas more than two levels.- print_legend
Logical. Whether to print legend. Defaults to
TRUE.- legend_txt
Character vector containing labels for legend.
- legend_pos
Legend position, used only when
mirror = FALSE. The mirror layout always places the legends at the top and bottom right.- legend_size
Legend size (
cexargument). Default is1.- mirror
Logical. Whether to plot as mirror or stacked plots. Defaults to
TRUE.- xlim
Numerical vector specifying limits for x axis.
- ylim
Numerical vector specifying limits for y axis.
- ...
Additional arguments to
matplot.
Details
Compares the chromatograms in two groups, defined by the levels of var.
When mirror is TRUE both are drawn in one panel, with the second
inverted below the axis; when it is FALSE they are drawn in two stacked
panels.
See also
Other visualization functions:
boxplot.peak_table(),
plot.chrom_list(),
plot.matched_peak_list(),
plot.peak_list(),
plot.peak_table(),
plot_all_spectra(),
plot_chrom_contour(),
plot_chroms(),
plot_chroms_heatmap(),
plot_spectrum(),
scan_chrom()
Examples
data(Sa_warp)
data(pk_tab)
path <- system.file("extdata", "Sa_metadata.csv", package = "chromatographR")
meta <- read.csv(path)
pk_tab <- attach_metadata(peak_table = pk_tab, metadata = meta, column="vial")
mirror_plot(pk_tab,lambdas = c("210","260"), var = "trt", mirror = TRUE,
col = c("green","blue"))
