plotDensityDimRed {rliger} | R Documentation |
Create density plot basing on specified coordinates
Description
This function shows the cell density presented in a 2D
dimensionality reduction coordinates. Density is shown with coloring and
contour lines. A scatter plot of the dimensionality reduction is added as
well. The density plot can be splitted by categorical variables (e.g.
"dataset"
), while the scatter plot will always be shown for all cells
in subplots as a reference of the global structure.
Usage
plotDensityDimRed(
object,
useDimRed = NULL,
splitBy = NULL,
combinePlot = TRUE,
minDensity = 8,
contour = TRUE,
contourLineWidth = 0.3,
contourBins = 5,
dot = TRUE,
dotColor = "grey",
dotSize = 0.6,
dotAlpha = 0.3,
dotRaster = NULL,
title = NULL,
legendFillTitle = "Density",
colorPalette = "magma",
colorDirection = -1,
...
)
Arguments
object |
A liger object |
useDimRed |
Name of the variable storing dimensionality reduction result
in the |
splitBy |
Character vector of categorical variable names in
|
combinePlot |
Logical, whether to utilize
|
minDensity |
A positive number to filter out low density region colored
on plot. Default |
contour |
Logical, whether to draw the contour line. Default
|
contourLineWidth |
Numeric, the width of the contour line. Default
|
contourBins |
Number of contour bins. Higher value generates more
contour lines. Default |
dot |
Logical, whether to add scatter plot of all cells, even when
density plot is splitted with |
dotColor , dotSize , dotAlpha |
Numeric, controls the appearance of all
dots. Default |
dotRaster |
Logical, whether to rasterize the scatter plot. Default
|
title |
Text of main title of the plots. Default |
legendFillTitle |
Text of legend title. Default |
colorPalette |
Name of the option for
|
colorDirection |
Color gradient direction for
|
... |
More theme setting arguments passed to
|
Value
A ggplot object when only one plot is generated, A ggplot object
combined with plot_grid
when multiple plots and
combinePlot = TRUE
. A list of ggplot when multiple plots and
combinePlot = FALSE
.
Examples
# Example dataset has small number of cells, thus cutoff adjusted.
plotDensityDimRed(pbmcPlot, minDensity = 1)