scPlotPCAvarExplained: Plot the percent of variation explained by individual PC's

View source: R/Seurat.Utils.Visualization.R

scPlotPCAvarExplainedR Documentation

Plot the percent of variation explained by individual PC's

Description

This function plots the percentage of variation explained by each principal component (PC) in a Seurat object. It allows for a visual assessment of how much variance is captured by each PC, which is crucial for dimensionality reduction analyses. Users can choose between two plotting methods: one using MarkdownReports and the other using ggExpress.

Usage

scPlotPCAvarExplained(
  obj = combined.obj,
  plotname = "Variance Explained by Principal Components",
  sub = paste(ncol(obj), "cells, ", nrow(obj), "features."),
  caption = "hline at 1%",
  use.MarkdownReports = FALSE,
  ...
)

Arguments

obj

A Seurat object from which to plot the percentage of variation explained by each PC. Default: combined.obj.

plotname

The title of the plot to be generated. Default: "Variance Explained by Principal Components".

sub

Subtitle for the plot, typically including information about the number of cells and features analyzed. Default: A string generated from obj stating the number of cells and features.

caption

A caption for the plot. Default: "hline at 1%".

use.MarkdownReports

Boolean indicating whether to use MarkdownReports for plotting. If FALSE, ggExpress is used. Default: FALSE.

...

Additional arguments to be passed to ggExpress::qbarplot or MarkdownReports::wbarplot.

Value

Generates a plot showing the percent of variation each PC accounts for. This function does not return a value but instead generates a plot directly.

Examples

## Not run: 
if (interactive()) {
  data("combined.obj") # Example Seurat object
  scPlotPCAvarExplained(combined.obj, use.MarkdownReports = TRUE)
}

## End(Not run)


vertesy/Seurat.utils documentation built on Dec. 4, 2024, 5:20 p.m.