ST.DimPlot | R Documentation |
Graphs the selected vectors of a dimensional reduction technique on a 2D grid of spots.
ST.DimPlot( object, dims = c(1, 2), spots = NULL, indices = NULL, plot.type = "spots", blend = FALSE, min.cutoff = NA, max.cutoff = NA, pt.size = 1, pt.alpha = 1, pt.border = FALSE, reduction = NULL, palette = "MaYl", cols = NULL, dark.theme = FALSE, ncol = NULL, grid.ncol = NULL, center.zero = TRUE, channels.use = NULL, center.tissue = FALSE, verbose = FALSE, sb.size = 2.5, show.sb = TRUE, value.scale = c("samplewise", "all"), label.by = NULL, ... )
object |
Seurat object |
dims |
Dimensions to plot [default: 1, 2] |
spots |
Character vector with spot IDs to plot [default: all spots] |
indices |
Indices to subset data by |
plot.type |
Specify the type of plot to use [default: "spots"]. Available options are; "spots" (a "smooth" options will be added soon) |
blend |
Scale and blend expression values to visualize coexpression of two features (this options will override other coloring parameters). See 'Blending values' below for a more thourough description. |
min.cutoff, max.cutoff |
Vector of minimum and maximum cutoff values for each feature, may specify quantile in the form of 'q##' where '##' is the quantile (eg, 'q1', 'q10'). This can be useful if you have outlier values that skew the colorscale in the plot. For example, if you specify 'q1', you will trim of values below the 1st percentile. [default: no cuttoffs] |
pt.size |
Adjust point size for plotting [default: 1] |
pt.alpha |
Adjust point opacity for plotting [default: 1] |
pt.border |
Should a border be drawn around the spots? [default: TRUE] |
reduction |
Which dimensionality reduction to use. If not specified, first searches for "umap", then "tsne", then "pca" |
palette |
Color palette used for spatial heatmap (see |
cols |
A vector of colors to use for colorscale, e.g. |
dark.theme |
Switches color of scalebar to 'white' |
ncol |
Number of columns to arrange the samples into. This can for example be useful to adjust if you want to visualize the samples in just in one row or one column. |
grid.ncol |
Number of columns for display when combining plots. This option will only have an effect on the sample level structure. |
center.zero |
Specifies whther or not the colorscale should be centered around 0. For some values, such as Principal Component vectors,
the distribution of values is centered at 0 and in that case it can be appropriate to use a divergent colorscale with a predefined value for 0.
If this parameter is set to TRUE, the ggplot2 function |
channels.use |
Color channels to use for blending. Has to be a character vector of length 2 or 3 with "red", "green" and "blue" color names specified [default: c("red", "green", "blue)] |
center.tissue |
Adjust coordinates so that the center of the tissue is in the middle of the array along the y-axis. This can be useful if your
samples have been placed in very different parts of the capture area and you want to center the plots in the middle. This is however unnecessary if
you have already aligned the sample data (see |
verbose |
Print messages |
sb.size |
Size of scalebar [default: 2.5] |
show.sb |
Should a scalebar be drawn? [default: TRUE] |
value.scale |
Defines how the dimensionality reduction values should be mapped to the colorbar. 'value.scale = "samplewise"' will scale each feature independantly while 'value.scale = "all"' will use the same value range for all vectors |
label.by |
Feature to relabel facets by. By default, facets are given a unique section number ranging grom 1 to the number of sections available in the 'Staffli' object. If you want to relabel these facets you can pass the name of a column that keeps the labels that you want to use. For example, if you wish to rename the facets to use labels defined by a charcater vector in column "section_id" in your meta.data slot, you can pass 'label.by = "section_id"' to relabel the facets. Only works for categorical group variables with where the number of groups is less than or equal to the number of tissue sections in your Staffli object. |
... |
Extra parameters passed on to |
A ggplot object
The blend option can be useful if you wish to visualize multiple dimensions simultaneuosly and works for two or three dimensionality reduction vectors. Each of the selected vectors are rescaled from 0 to 1 and are used as RGB color channels to produce mixed color for each spot. This can be particularly useful when looking at overlapping value vectors. For example, if you are looking at two overlapping value vectors "A" and "B" and use the blend option, the "A" values will be encoded in the "red" channel and the "B" values in the "green" channel. If a spot is purely "A" the color will be red and if it is purely "B" it will green. Any mixture of "A" and "B" will produce a color between red and green where a 50/50 mixture gives yellow color. The amplitude if the values will also determine the brightness of the color.
Note that the dimensionality reduction outputs from method s.a. PCA, ICA and UMAP are typically centered at 0 and it is tehrefore appropriate to use a divergent colorscale for this type of output, e.g. the "RdBu" color palette in RColorBrewer. However, if you are plotting factor from the Non-negative Matrix Factorization (NMF) method, you will only have positive value and the 'center.zero' argument should tehrefore be set to FALSE.
ST.FeaturePlot
for how to plot features,
FeatureOverlay
and DimOverlay
for how to overlay plots on the
HE images.
## Not run: se <- RunPCA(se) # Plot the first 5 dimensions ST.DimPlot(se, dims = 1:5, reduction = "pca") # Plot the first 5 dimensions and put each sample in a separate row ST.DimPlot(se, dims = 1:5, reduction = "pca", grid.ncol = 1) # Blend values for dimensions 1 and 2 ST.DimPlot(se, dims = 1:2, reduction = "pca", blend = T) # Plot the first 5 dimensions and trim off 1st percentile values ST.DimPlot(se, dims = 1:5, reduction = "pca", min.cutoff = 'q1') ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.