qSeuViolin: Create a Violin Plot for a Seurat Object Feature and save the...

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

qSeuViolinR Documentation

Create a Violin Plot for a Seurat Object Feature and save the file.

Description

Generates a violin plot for a specified feature in a Seurat object, allowing for the data to be split by a specified grouping variable. The function supports customization options such as logarithmic scaling, custom titles, and more.

Usage

qSeuViolin(
  obj,
  feature = "nFeature_RNA",
  ident = GetNamedClusteringRuns(obj = obj, v = FALSE)[1],
  assay = "RNA",
  slot = "data",
  split.by = NULL,
  colors = NULL,
  clip.outliers = TRUE,
  replace.na = FALSE,
  pt.size = 0,
  sub = NULL,
  suffix = NULL,
  suffix.2.title = FALSE,
  caption = try(.parseKeyParams(obj), silent = TRUE),
  logY = TRUE,
  hline = FALSE,
  ylab = "Expression",
  ylimit = NULL,
  legend = TRUE,
  legend.pos = NULL,
  legend.title = NULL,
  show_plot = TRUE,
  grid = TRUE,
  w = NULL,
  h = 7,
  ...
)

Arguments

obj

A Seurat object to be plotted.

feature

A character string specifying the name of the feature to plot.

ident

A character vector specifying the identities to be used in the plot.

split.by

A character string specifying the grouping variable for splitting the plot.

colors

A character vector specifying the colors to use for the plot.

clip.outliers

A logical indicating whether to clip outliers.

replace.na

A logical indicating whether NA values should be replaced.

pt.size

The size of the individual datapoints in the plot. Default: 0 for simple violin plot.

sub

Subtitle of the plot. Default: feature by ident.

suffix

An optional string to append to the title of the plot.

suffix.2.title

A logical indicating whether to append the suffix to the plot title.

caption

A character string or logical for the plot caption. If FALSE, no caption is displayed.

logY

A logical indicating whether to use a logarithmic scale for the y-axis.

hline

A numeric or logical value; if numeric, the value where a horizontal line should be drawn.

ylab

Y-axis label. Default: "Expression".

ylimit

A numeric vector specifying the limits of the y-axis.

legend

Show legend; Default: opposite of label.

legend.pos

Position of legend; Default: 'NULL'.

legend.title

Title of legend; Default: 'split.by'.

show_plot

A logical indicating whether to display the plot.

grid

A logical indicating whether to display grid lines.

w

Width of the plot.

h

Height of the plot.

...

Additional arguments passed to VlnPlot.

Value

A ggplot object representing the violin plot.

Examples

# Assuming `seurat_obj` is a valid Seurat object
qSeuViolin(obj = seurat_obj, feature = "nFeature_RNA")


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