stackVlnPlot: Get stack violin plot for a normal matrix

View source: R/singlecell.R

stackVlnPlotR Documentation

Get stack violin plot for a normal matrix

Description

Get stack violin plot for a normal matrix

Usage

stackVlnPlot(data, x, y, facets, fill = NULL)

Arguments

data

At least three columns needed.

Gene Expr  Cluster
Sox2 2 1
Sox2 1.5 1
Sox2 1.2 1
Sox2 1.2 1
Sox2 20 2
Sox2 21 2
Sox2 22 2
Sox2 23 2
Sox2 0.4 3
Sox2 0.2 3
Sox3 2 1
Sox3 2 2
Sox3 2 3

facets

A set of variables or expressions quoted by vars() and defining faceting groups on the rows or columns dimension. The variables can be named (the names are passed to labeller).

For compatibility with the classic interface, can also be a formula or character vector. Use either a one sided formula, ~a + b, or a character vector, c("a", "b").

Value

a ggplot2 object

Examples


random_v <- c(rnorm(10, mean=1, sd=0.1), rnorm(10, mean=5), rnorm(20, mean=10),
              rnorm(10, mean=10), rnorm(10, mean=0.2, sd=0.01), rnorm(20, mean=1))
data <- data.frame(Gene=c(paste0('SOX', rep(2,40)), paste0('SOX', rep(3,40))),
                   Expr=random_v, Cluster=rep(c(rep(1,10), rep(2,10),rep(3,20)),2))
stackVlnPlot(data, x="Cluster", y="Expr", facets="Gene")


Tong-Chen/ImageGP documentation built on April 14, 2025, 12:54 p.m.