do_BarPlot()

Group by a variable

SCpubr::do_BarPlot(sample, 
                   group.by = "seurat_clusters")

Split by a variable

SCpubr::do_BarPlot(sample, 
                   group.by = "seurat_clusters",
                   split.by = "modified_orig.ident")

Plot proportions

SCpubr::do_BarPlot(sample, 
                   group.by = "seurat_clusters",
                   split.by = "modified_orig.ident",
                   position = "fill")

Add total number of counts

SCpubr::do_BarPlot(sample, 
                   group.by = "seurat_clusters",
                   split.by = "modified_orig.ident",
                   position = "fill",
                   add.n = TRUE)

Order by a value

SCpubr::do_BarPlot(sample, 
                   group.by = "seurat_clusters",
                   split.by = "modified_orig.ident",
                   position = "fill",
                   order = TRUE,
                   order.by = "1")

Facet by a variable

sample$facet_var <- ifelse(sample$modified_orig.ident == "Sample_A", "Group 1", "Group 2")

SCpubr::do_BarPlot(sample, 
                   group.by = "seurat_clusters",
                   split.by = "modified_orig.ident",
                   facet.by = "facet_var",
                   position = "fill")