plotDimRed {rliger} | R Documentation |
Generate scatter plot(s) using liger object
Description
This function allows for using available cell metadata to build
the x-/y-axis. Available per-cell data can be used to form the color/shape
annotation, including cell metadata, raw or processed gene expression, and
unnormalized or aligned factor loading. Multiple coloring variable is allowed
from the same specification of slot
, and this returns a list of plots
with different coloring values. Users can further split the plot(s) by
grouping on cells (e.g. datasets).
some text
Usage
plotDimRed(
object,
colorBy = NULL,
useDimRed = NULL,
slot = c("cellMeta", "rawData", "normData", "scaleData", "H.norm", "H", "normPeak",
"rawPeak"),
colorByFunc = NULL,
cellIdx = NULL,
splitBy = NULL,
shapeBy = NULL,
titles = NULL,
...
)
plotClusterDimRed(object, useCluster = NULL, useDimRed = NULL, ...)
plotDatasetDimRed(object, useDimRed = NULL, ...)
plotByDatasetAndCluster(
object,
useDimRed = NULL,
useCluster = NULL,
combinePlots = TRUE,
...
)
plotGeneDimRed(
object,
features,
useDimRed = NULL,
log = TRUE,
scaleFactor = 10000,
zeroAsNA = TRUE,
colorPalette = "C",
...
)
plotPeakDimRed(
object,
features,
useDimRed = NULL,
log = TRUE,
scaleFactor = 10000,
zeroAsNA = TRUE,
colorPalette = "C",
...
)
plotFactorDimRed(
object,
factors,
useDimRed = NULL,
trimHigh = 0.03,
zeroAsNA = TRUE,
colorPalette = "D",
...
)
Arguments
object |
A liger object. |
colorBy |
Available variable name in specified |
useDimRed |
Name of the variable storing dimensionality reduction result
in the |
slot |
Choose the slot to find the |
colorByFunc |
Default |
cellIdx |
Character, logical or numeric index that can subscribe cells.
Missing or |
splitBy |
Character vector of categorical variable names in
|
shapeBy |
Available variable name in |
titles |
Title text. A character scalar or a character vector with as
many elements as multiple plots are supposed to be generated. Default
|
... |
More plot setting arguments. See |
useCluster |
Name of variable in |
combinePlots |
Logical, whether to utilize
|
features , factors |
Name of genes or index of factors that need to be visualized. |
log |
Logical. Whether to log transform the normalized expression of
genes. Default |
scaleFactor |
Number to be multiplied with the normalized expression of
genes before log transformation. Default |
zeroAsNA |
Logical, whether to swap all zero values to |
colorPalette |
Name of viridis palette. See
|
trimHigh |
Number for highest cut-off to limit the outliers. Factor
loading above this value will all be trimmed to this value. Default
|
Details
Available option for slot
include: "cellMeta"
,
"rawData"
, "normData"
, "scaleData"
, "H.norm"
and "H"
. When "rawData"
, "normData"
or
"scaleData"
, colorBy
has to be a character vector of feature
names. When "H.norm"
or "H"
, colorBy
can be any valid
index to select one factor of interests. Note that character index follows
"Factor_[k]"
format, with replacing [k]
with an integer.
When "cellMeta"
, colorBy
has to be an available column name in
the table. Note that, for colorBy
as well as x
, y
,
shapeBy
and splitBy
, since a matrix object is feasible in
cellMeta
table, using a column (e.g. named as "column1"
in a
certain matrix (e.g. named as "matrixVar"
) should follow the syntax of
"matrixVar.column1"
. When the matrix does not have a "colname"
attribute, the subscription goes with "matrixVar.V1"
,
"matrixVar.V2"
and etc. Use "UMAP.1"
, "UMAP.2"
,
"TSNE.1"
or "TSNE.2"
for the 2D embeddings generated with
rliger package. These are based on the nature of as.data.frame
method
on a DataFrame
object.
Value
A ggplot object when a single plot is intended. A list of ggplot
objects, when multiple colorBy
variables and/or splitBy
are
set. When plotly = TRUE
, all ggplot objects become plotly (htmlwidget)
objects.
ggplot object when only one feature (e.g. cluster variable, gene, factor) is set. List object when multiple of those are specified.
See Also
Please refer to plotDimRed
,
.ggScatter
, .ggplotLigerTheme
for additional
graphic setting
Examples
plotDimRed(pbmcPlot, colorBy = "dataset", slot = "cellMeta",
labelText = FALSE)
plotDimRed(pbmcPlot, colorBy = "S100A8", slot = "normData",
dotOrder = "ascending", dotSize = 2)
plotDimRed(pbmcPlot, colorBy = 2, slot = "H.norm",
dotOrder = "ascending", dotSize = 2, colorPalette = "viridis")
plotClusterDimRed(pbmcPlot)
plotDatasetDimRed(pbmcPlot)
plotByDatasetAndCluster(pbmcPlot)
plotGeneDimRed(pbmcPlot, varFeatures(pbmcPlot)[1])
plotFactorDimRed(pbmcPlot, 2)