Skip to contents

QC plot function used to get a quick overview of called cells in an MPX data set.

Usage

CellCountPlot(object, ...)

# S3 method for data.frame
CellCountPlot(
  object,
  group_by = NULL,
  color_by,
  show_count = TRUE,
  flip_axes = FALSE,
  ...
)

# S3 method for Seurat
CellCountPlot(
  object,
  group_by = NULL,
  color_by,
  show_count = TRUE,
  flip_axes = FALSE,
  ...
)

Arguments

object

A data.frame-like object or a Seurat object

...

Not yet implemented

group_by

A column in the object representing a 'character' or 'factor' to group data by

color_by

A column in the object representing a 'character' or 'factor' to color data by

show_count

Place the count on top of the bar or next to the bar if flip_axes = TRUE

flip_axes

Flip the plot layout

Value

A ggplot object

See also

Other QC-plots: TauPlot()

Examples


library(pixelatorR)

# Load example data as a Seurat object
pxl_file <- system.file("extdata/five_cells",
  "five_cells.pxl",
  package = "pixelatorR"
)
seur_obj <- ReadMPX_Seurat(pxl_file)
#>  Created a 'Seurat' object with 5 cells and 80 targeted surface proteins
seur_obj
#> An object of class Seurat 
#> 80 features across 5 samples within 1 assay 
#> Active assay: mpxCells (80 features, 80 variable features)
#>  1 layer present: counts

# Add random labels to color by
seur_obj$labels <- sample(c("A", "B"), size = ncol(seur_obj), replace = TRUE)

# Plot with data.frame and color by labels
CellCountPlot(seur_obj[[]], color_by = "labels")


# Plot with Seurat object
CellCountPlot(seur_obj, color_by = "labels")


# Color by sample in merged data
seur_obj1 <- seur_obj2 <- seur_obj
seur_obj1$sample <- "1"
seur_obj2$sample <- "2"
seur_obj_merged <- merge(seur_obj1, seur_obj2, add.cell.ids = c("A", "B"))
CellCountPlot(seur_obj_merged, group_by = "labels", color_by = "sample")