QC Scatter Plot with Marginal Densities
qcScatter.RdGenerates a two-panel QC scatter plot for any pair of metadata variables.
The top panel shows all samples overlaid with marginal density curves
(via ggExtra::ggMarginal()). The bottom panel facets by the grouping
variable. Axes can optionally be log10-scaled. This function assumes
you have extracted the metadata from your Seurat object and saved as a
dataframe.
Usage
qcScatter(
metadata,
Xvar,
Yvar,
groupVar = "orig.ident",
logTransformX = FALSE,
logTransformY = FALSE,
colors = NULL,
outDir = NULL,
width,
height
)Arguments
- metadata
A data frame of per-cell or per-sample QC metrics.
- Xvar
Character string. Column name in
metadatafor the x-axis.- Yvar
Character string. Column name in
metadatafor the y-axis.- groupVar
Character string. Column name in
metadataused for color and faceting (default"orig.ident").- logTransformX
Logical. Apply
ggplot2::scale_x_log10()(defaultFALSE).- logTransformY
Logical. Apply
ggplot2::scale_y_log10()(defaultFALSE).- colors
Optional named or positional color vector for groups (default
NULL, in which case, 8 default colors are used.)- outDir
Optional directory path for saving the plot. If
NULL(default), the plot is not saved.- width
Numeric. Plot width in inches (default
12).- height
Numeric. Plot height in inches (default
10).
Value
A combined cowplot::plot_grid() object (returned invisibly when
saved to disk).