This function generates a projection plot, which can be used to compare two groups of cells in a dimensionality reduction space.
Usage
ProjectionPlot(
  srt_query,
  srt_ref,
  query_group = NULL,
  ref_group = NULL,
  query_reduction = "ref.embeddings",
  ref_reduction = srt_query[[query_reduction]]@misc[["reduction.model"]] %||% NULL,
  query_param = list(palette = "Set1", cells.highlight = TRUE),
  ref_param = list(palette = "Paired"),
  xlim = NULL,
  ylim = NULL,
  pt.size = 0.8,
  stroke.highlight = 0.5
)Arguments
- srt_query
- An object of class Seurat storing the query group cells. 
- srt_ref
- An object of class Seurat storing the reference group cells. 
- query_group
- The grouping variable for the query group cells. 
- ref_group
- The grouping variable for the reference group cells. 
- query_reduction
- The name of the reduction in the query group cells. 
- ref_reduction
- The name of the reduction in the reference group cells. 
- query_param
- A list of parameters for customizing the query group plot. Available parameters: palette (color palette for groups) and cells.highlight (whether to highlight cells). 
- ref_param
- A list of parameters for customizing the reference group plot. Available parameters: palette (color palette for groups) and cells.highlight (whether to highlight cells). 
- xlim
- The x-axis limits for the plot. If not provided, the limits will be calculated based on the data. 
- ylim
- The y-axis limits for the plot. If not provided, the limits will be calculated based on the data. 
- pt.size
- The size of the points in the plot. 
- stroke.highlight
- The size of the stroke highlight for cells. 
Examples
data("panc8_sub")
srt_ref <- panc8_sub[, panc8_sub$tech != "fluidigmc1"]
srt_query <- panc8_sub[, panc8_sub$tech == "fluidigmc1"]
srt_ref <- Integration_SCP(srt_ref, batch = "tech", integration_method = "Seurat")
#> [2025-09-08 16:13:22.701419] Start Seurat_integrate
#> Error in invoke(.fn = paste0(integration_method, "_integrate"), .args = args[names(args) %in%     formalArgs(paste0(integration_method, "_integrate"))]): could not find function "invoke"
CellDimPlot(srt_ref, group.by = c("celltype", "tech"))
#> Error in DefaultReduction(srt): Unable to find any reductions.
# Projection
srt_query <- RunKNNMap(srt_query = srt_query, srt_ref = srt_ref, ref_umap = "SeuratUMAP2D")
#> Error in srt_ref[[ref_umap]]: ‘SeuratUMAP2D’ not found in this Seurat object
#>  
ProjectionPlot(srt_query = srt_query, srt_ref = srt_ref, query_group = "celltype", ref_group = "celltype")
#> Error in srt_query[[query_reduction]]: ‘ref.embeddings’ not found in this Seurat object
#>