stackVlnPlot: Get stack violin plot for a normal matrix

Description Usage Arguments Value Examples

View source: R/singlecell.R

Description

Get stack violin plot for a normal matrix

Usage

1
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

x

List of name-value pairs in the form aesthetic = variable describing which variables in the layer data should be mapped to which aesthetics used by the paired geom/stat. The expression variable is evaluated within the layer data, so there is no need to refer to the original dataset (i.e., use ggplot(df, aes(variable)) instead of ggplot(df, aes(df$variable))). The names for x and y aesthetics are typically omitted because they are so common; all other aesthetics must be named.

y

List of name-value pairs in the form aesthetic = variable describing which variables in the layer data should be mapped to which aesthetics used by the paired geom/stat. The expression variable is evaluated within the layer data, so there is no need to refer to the original dataset (i.e., use ggplot(df, aes(variable)) instead of ggplot(df, aes(df$variable))). The names for x and y aesthetics are typically omitted because they are so common; all other aesthetics must be named.

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

1
2
3
4
5
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/YSX documentation built on Jan. 25, 2021, 2:49 a.m.