% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ClusterDistrBar.R
\name{ClusterDistrBar}
\alias{ClusterDistrBar}
\title{Cluster proportion bar plot}
\usage{
ClusterDistrBar(
  origin,
  cluster,
  rev = F,
  normalize = rev,
  percent = T,
  plot = T,
  flip = T,
  reverse_order = T,
  width = 0.9,
  stack = T,
  cols = "pro_default",
  border = "white"
)
}
\arguments{
\item{origin}{factor/vector of sample}

\item{cluster}{factor/vector of cluster}

\item{rev}{If TRUE, plot the proportion of sample in each cluster, Default: F}

\item{normalize}{Normalize sample size to 100, Default: rev}

\item{percent}{If FALSE, plot absolute cell number instead of percentage, Default: T}

\item{plot}{Generate plot (TRUE) or matrix (FALSE), Default: T}

\item{flip}{If plot bars horizontally, Default: T}

\item{reverse_order}{If TRUE, will reverse the default stacking order. Default: T}

\item{width}{Width of bars, Default: 0.9}

\item{stack}{If TRUE, plot stacked bars, Default: T}

\item{cols}{Colors to use for plotting. Default: "pro_default"}

\item{border}{Border color, Default: "white"}
}
\value{
ggplot object or matrix
}
\description{
Plot the percentage/absolute cell count of each cluster in each sample
}
\details{
See example
}
\examples{
ClusterDistrBar(origin = pbmc$orig.ident, cluster = pbmc$cluster)

# absolute cell count
ClusterDistrBar(origin = pbmc$orig.ident, cluster = pbmc$cluster, percent = F)

# reverse x and y axis, normalized by sample size
ClusterDistrBar(origin = pbmc$orig.ident, cluster = pbmc$cluster, rev = T, normalize = T)

# reverse x and y axis, not normalized by sample size
ClusterDistrBar(origin = pbmc$orig.ident, cluster = pbmc$cluster, rev = T, normalize = F)

# vertical bar plot
ClusterDistrBar(origin = pbmc$orig.ident, cluster = pbmc$cluster, flip = F)

# not stacking bars
ClusterDistrBar(origin = pbmc$orig.ident, cluster = pbmc$cluster, flip = FALSE, stack = FALSE)

# export matrix
ClusterDistrBar(origin = pbmc$orig.ident, cluster = pbmc$cluster, plot = F)
}
