Skip to contents

Engine-agnostic pseudotime panel: takes any numeric meta.data column, so the same function plots a Slingshot lineage ("Slingshot_Pseudotime_1"), a Monocle3 pseudotime ("Monocle3_Pseudotime"), or any other pseudotime-like column, without re-implementing the same density/ridge plotting code per method.

Produces a density + rug plot (plot.type = "density", default) or a ridge plot (plot.type = "ridge") of pseudotime per group.by level, with peak labels for the density style. split.by/row.by facet either style into column/row panels, the same way as every other scSidekick plotting function.

Usage

PlotPseudotime(
  seurat_object,
  pseudotime.by,
  group.by = NULL,
  split.by = NULL,
  row.by = NULL,
  plot.type = c("density", "ridge"),
  scales = "fixed",
  ncol = NULL,
  colors = NULL,
  output_dir = NULL,
  object_name = "",
  subset_name = "",
  file_name = NULL,
  width = NULL,
  height = NULL,
  timestamp = FALSE
)

Arguments

seurat_object

A Seurat object.

pseudotime.by

Character. Numeric meta.data column holding a pseudotime value (e.g. from RunSlingshot).

group.by

Character or NULL. Cluster/cell-type column - colors the density curves, or is the y-axis of the ridge plot. NULL (default) uses the cluster.by stored by RunSlingshot when present.

split.by

Character or NULL. Creates column facets - one panel per level. NULL (default) = no column split.

row.by

Character or NULL. Creates row facets, the same way as split.by. Combined with split.by produces a two-way grid. NULL (default) = no row split.

plot.type

One of "density" (default: density + rug curves per group.by level, with peak labels) or "ridge" (one ridge per group.by level via ggridges).

scales

Character. Passed to facet_wrap()/facet_grid() when split.by/row.by is set. Default "fixed".

ncol

Integer or NULL. Facet columns when only split.by is set. NULL auto-picks.

colors

Named color vector for group.by. NULL auto-resolves from PrepObject or Nour_pal.

output_dir

Character or NULL. Directory to save a PDF. NULL (default) walks up to the output_dir stored by PrepObject (respecting AutoSavePlots); pass NA to suppress entirely.

object_name, subset_name

Character. Output file-name prefixes.

file_name

Character or NULL. Base name (no extension) for the saved PDF. NULL auto-deduces from pseudotime.by, group.by, split.by, and row.by.

width, height

Numeric or NULL. Saved PDF dimensions in inches. NULL (default) auto-sizes from the facet grid.

timestamp

Logical. When TRUE, append a _YYYYMMDD-HHMMSS stamp to the saved file name so repeated runs are versioned instead of overwriting the previous PDF. Default FALSE.

Value

A ggplot object.