% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/cell_bar_plot.R
\name{cell_bar_plot}
\alias{cell_bar_plot}
\title{Visualize Cell Fractions as Stacked Bar Chart}
\usage{
cell_bar_plot(
  input,
  id = "ID",
  title = "Cell Fraction",
  features = NULL,
  pattern = NULL,
  legend.position = "bottom",
  coord_flip = TRUE,
  palette = 3,
  show_col = FALSE,
  cols = NULL
)
}
\arguments{
\item{input}{Data frame containing deconvolution results.}

\item{id}{Character string specifying the column name containing sample
identifiers. Default is "ID".}

\item{title}{Character string specifying the plot title.
Default is "Cell Fraction".}

\item{features}{Character vector specifying column names representing cell
types to plot. If NULL, columns are selected based on `pattern`.
Default is NULL.}

\item{pattern}{Character string or regular expression to match column names
for automatic feature selection. Used when `features` is NULL.
Default is NULL.}

\item{legend.position}{Character string specifying legend position
("bottom", "top", "left", "right"). Default is "bottom".}

\item{coord_flip}{Logical indicating whether to flip plot coordinates using
`coord_flip()`. Default is TRUE.}

\item{palette}{Integer specifying the color palette to use. Default is 3.}

\item{show_col}{Logical indicating whether to display color information.
Default is FALSE.}

\item{cols}{Character vector of custom colors. If NULL, palette is used.
Default is NULL.}
}
\value{
A ggplot2 object representing the stacked bar chart.
}
\description{
Creates stacked bar charts to visualize tumor microenvironment (TME) cell
fractions. Supports batch visualization of deconvolution results from
methods such as CIBERSORT, EPIC, and quanTIseq.
}
\examples{
set.seed(123)
input_data <- data.frame(
  ID = paste0("Sample", 1:10),
  Cell_A = runif(10, 0, 0.4),
  Cell_B = runif(10, 0, 0.3),
  Cell_C = runif(10, 0, 0.3)
)
cell_bar_plot(input = input_data, id = "ID", features = c("Cell_A", "Cell_B", "Cell_C"))
}
\author{
Dongqiang Zeng
}
