Visualize a spatial dataset
Usage
plotSpatial2D(object, ...)
# S3 method for liger
plotSpatial2D(object, dataset, useCluster = NULL, legendColorTitle = NULL, ...)
# S3 method for ligerSpatialDataset
plotSpatial2D(
object,
useCluster = NULL,
legendColorTitle = NULL,
useDims = c(1, 2),
xlab = NULL,
ylab = NULL,
labelText = FALSE,
...
)
Arguments
- object
Either a liger object containing a spatial dataset or a ligerSpatialDataset object.
- ...
Arguments passed to other methods.
.liger
method passes everything to.ligerSpatialDataset
method, and the latter passes everything to.ggScatter
and then.ggplotLigerTheme
.- dataset
Name of one spatial dataset.
- useCluster
Either the name of one variable in
cellMeta(object)
or a factor object with annotation that matches with all cells in the specified dataset. DefaultNULL
uses default clusters.- legendColorTitle
Alternative title text in the legend. Default
NULL
uses the variable name set byuseCluster
, or"Annotation"
isuseCluster
is a customized factor object.- useDims
Numeric vector of two, choosing the coordinates to be drawn on 2D space. (STARmap data could have 3 dimensions.) Default
c(1, 2)
.- xlab, ylab
Text label on x-/y-axis. Default
NULL
does not show it.- labelText
Logical, whether to label annotation onto the scatter plot. Default
FALSE
.
Examples
ctrl.fake.spatial <- as.ligerDataset(dataset(pbmc, "ctrl"), modal = "spatial")
fake.coords <- matrix(rnorm(2 * ncol(ctrl.fake.spatial)), ncol = 2)
dimnames(fake.coords) <- list(colnames(ctrl.fake.spatial), c("x", "y"))
coordinate(ctrl.fake.spatial) <- fake.coords
dataset(pbmc, "ctrl") <- ctrl.fake.spatial
plotSpatial2D(pbmc, dataset = "ctrl")