Skip to contents

Plotting cell points on a reduced 3D space and coloring according to the groups of the cells.

Usage

CellDimPlot3D(
  srt,
  group.by,
  reduction = NULL,
  dims = c(1, 2, 3),
  axis_labs = NULL,
  palette = "Paired",
  palcolor = NULL,
  bg_color = "grey80",
  pt.size = 1.5,
  cells.highlight = NULL,
  cols.highlight = "black",
  shape.highlight = "circle-open",
  sizes.highlight = 2,
  lineages = NULL,
  lineages_palette = "Dark2",
  span = 0.75,
  width = NULL,
  height = NULL,
  save = NULL,
  force = FALSE
)

Arguments

srt

A Seurat object.

group.by

Name of one or more meta.data columns to group (color) cells by (for example, orig.ident).

reduction

Which dimensionality reduction to use. If not specified, will use the reduction returned by DefaultReduction.

dims

Dimensions to plot, must be a three-length numeric vector specifying x-, y- and z-dimensions

axis_labs

A character vector of length 3 indicating the labels for the axes.

palette

Name of a color palette name collected in SCP. Default is "Paired".

palcolor

Custom colors used to create a color palette.

bg_color

Color value for background(NA) points.

pt.size

Point size.

cells.highlight

A vector of cell names to highlight.

cols.highlight

Color used to highlight the cells.

shape.highlight

Shape of the cell to highlight. See scattergl-marker-symbol

sizes.highlight

Size of highlighted cell points.

lineages

Lineages/pseudotime to add to the plot. If specified, curves will be fitted using loess method.

lineages_palette

Color palette used for lineages.

span

A numeric value specifying the span of the loess smoother for lineages line.

width

Width in pixels, defaults to automatic sizing.

height

Height in pixels, defaults to automatic sizing.

save

The name of the file to save the plot to. Must end in ".html".

force

Whether to force drawing regardless of maximum levels in any cell group is greater than 100.

Examples

data("pancreas_sub")
pancreas_sub <- Standard_SCP(pancreas_sub)
#> [2025-09-08 16:11:26.926724] Start Standard_SCP
#> [2025-09-08 16:11:26.92698] Checking srtList... ...
#> Warning: Failed to check Seurat version compatibility: 'list' object cannot be coerced to type 'double'
#> Warning: The following arguments are not used: drop
#> Warning: The following arguments are not used: drop
#> Error in as.vector(data): no method for coercing this S4 class to a vector
CellDimPlot3D(pancreas_sub, group.by = "SubCellType", reduction = "StandardpcaUMAP3D")
#> Error in col2hex(bg_color): could not find function "col2hex"

pancreas_sub <- RunSlingshot(pancreas_sub, group.by = "SubCellType", reduction = "StandardpcaUMAP3D")
#> Warning: No shared levels found between `names(values)` of the manual scale and the data's fill values.
#> Warning: No shared levels found between `names(values)` of the manual scale and the data's fill values.
#> Warning: Removed 8 rows containing missing values or values outside the scale range (`geom_path()`).
#> Warning: Removed 8 rows containing missing values or values outside the scale range (`geom_path()`).
#> Error in gtable_add_grob(gtable, grob, t = mean(gtable$layout[grep("panel",     gtable$layout$name), "t"]), l = dim(gtable)[2], clip = clip): `grobs` must be a single grob or a list of grobs, not a list matrix.
CellDimPlot3D(pancreas_sub, group.by = "SubCellType", reduction = "StandardpcaUMAP3D", lineages = "Lineage1")
#> Error in col2hex(bg_color): could not find function "col2hex"