Load libraries

library(dplyr)
library(Seurat)
library(patchwork)
library(ggplot2)
library(ComplexHeatmap)
library(SeuratData)
set.seed(1234)

prepare the data

data("pbmc3k") pbmc3k
#> An object of class Seurat #> 13714 features across 2700 samples within 1 assay #> …