plotEmbedding.Rd
This function will plot an embedding stored in an ArchRProject
plotEmbedding(
ArchRProj = NULL,
embedding = "UMAP",
colorBy = "cellColData",
name = "Sample",
log2Norm = NULL,
imputeWeights = if (!grepl("coldata", tolower(colorBy[1]))) getImputeWeights(ArchRProj),
pal = NULL,
size = 0.1,
sampleCells = NULL,
highlightCells = NULL,
rastr = TRUE,
quantCut = c(0.01, 0.99),
discreteSet = NULL,
continuousSet = NULL,
randomize = TRUE,
keepAxis = FALSE,
baseSize = 10,
plotAs = NULL,
threads = getArchRThreads(),
logFile = createLogFile("plotEmbedding"),
...
)
An ArchRProject
object.
The name of the embedding stored in the ArchRProject
to be plotted. See computeEmbedding()
for more information.
A string indicating whether points in the plot should be colored by a column in cellColData
("cellColData") or by
a data matrix in the corresponding ArrowFiles (i.e. "GeneScoreMatrix", "MotifMatrix", "PeakMatrix").
The name of the column in cellColData
or the featureName/rowname of the data matrix to be used for plotting.
For example if colorBy is "cellColData" then name
refers to a column name in the cellcoldata
(see getCellcoldata()
). If colorBy
is "GeneScoreMatrix" then name
refers to a gene name which can be listed by getFeatures(ArchRProj, useMatrix = "GeneScoreMatrix")
.
A boolean value indicating whether a log2 transformation should be performed on the values (if continuous) in plotting.
The weights to be used for imputing numerical values for each cell as a linear combination of other cells values.
See addImputationWeights()
and getImutationWeights()
for more information.
A custom palette used to override discreteSet/continuousSet for coloring cells. Typically created using paletteDiscrete()
or paletteContinuous()
.
To make a custom palette, you must construct this following strict specifications. If the coloring is for discrete data (i.e. "Clusters"),
then this palette must be a named vector of colors where each color is named for the corresponding group (e.g. "C1" = "#F97070"
). If the coloring
for continuous data, then it just needs to be a vector of colors. If you are using pal
in conjuction with highlightCells
, your palette
must be a named vector with two entries, one named for the value of the cells in the name
column of cellColData
and the other named
"Non.Highlighted". For example, pal=c("Mono" = "green", "Non.Highlighted" = "lightgrey")
would be used to change the color of cells with the value
"Mono" in the cellColData
column indicated by name
. Because of this, the cells indicated by highlightCells
must also match this value in the name
column.
A number indicating the size of the points to plot if plotAs
is set to "points".
A numeric describing number of cells to use for plot. If using impute weights, this will occur after imputation.
A character vector of cellNames describing which cells to hightlight if using plotAs = "points"
(default if discrete).
The remainder of cells will be colored light gray.
A boolean value that indicates whether the plot should be rasterized. This does not rasterize lines and labels, just the internal portions of the plot.
If this is not NULL
, a quantile cut is performed to threshold the top and bottom of the distribution of numerical values.
This prevents skewed color scales caused by strong outliers. The format of this should be c(x,y) where x is the lower threshold and y is
the upper threshold. For example, quantileCut = c(0.025,0.975) will take the 2.5th percentile and 97.5 percentile of values and set
values below/above to the value of the 2.5th and 97.5th percentile values respectively.
The name of a discrete palette from ArchRPalettes
for visualizing colorBy
in the embedding if a discrete color set is desired.
The name of a continuous palette from ArchRPalettes
for visualizing colorBy
in the embedding if a continuous color set is desired.
A boolean value that indicates whether to randomize points prior to plotting to prevent cells from one cluster being uniformly present at the front of the plot.
A boolean value that indicates whether the x- and y-axis ticks and labels should be plotted.
The base font size to use in the plot.
A string that indicates whether points ("points") should be plotted or a hexplot ("hex") should be plotted. By default
if colorBy
is numeric, then plotAs
is set to "hex".
The number of threads to be used for parallel computing.
The path to a file to be used for logging ArchR output.
#Get Test Project
proj <- getTestProject()
#Plot UMAP
p <- plotEmbedding(proj, name = "Clusters")
#PDF
plotPDF(p, name = "UMAP-Clusters", ArchRProj = proj)