% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/percent_bar.R
\name{percent_bar_plot}
\alias{percent_bar_plot}
\title{Create a Percent Bar Plot}
\usage{
percent_bar_plot(
  input,
  x,
  y,
  subset.x = NULL,
  color = NULL,
  palette = NULL,
  title = NULL,
  axis_angle = 0,
  coord_flip = FALSE,
  add_Freq = TRUE,
  Freq = "Proportion",
  size_freq = 8,
  legend.size = 0.5,
  legend.size.text = 10,
  add_sum = TRUE,
  print_result = TRUE,
  round.num = 2
)
}
\arguments{
\item{input}{Input data frame.}

\item{x}{Name of the x-axis variable.}

\item{y}{Name of the y-axis (grouping) variable.}

\item{subset.x}{Optional subset of x-axis values.}

\item{color}{Optional color palette.}

\item{palette}{Optional palette type.}

\item{title}{Optional plot title.}

\item{axis_angle}{Angle for axis labels (0-90). Default is 0.}

\item{coord_flip}{Logical to flip coordinates. Default is FALSE.}

\item{add_Freq}{Logical to add frequency count. Default is TRUE.}

\item{Freq}{Name of frequency column.}

\item{size_freq}{Size of frequency labels. Default is 8.}

\item{legend.size}{Size of legend. Default is 0.5.}

\item{legend.size.text}{Size of legend text. Default is 10.}

\item{add_sum}{Logical to add sum to x-axis labels. Default is TRUE.}

\item{print_result}{Logical to print result data frame. Default is TRUE.}

\item{round.num}{Decimal places for proportion. Default is 2.}
}
\value{
A ggplot object.
}
\description{
Generates a bar plot visualizing the percentage distribution of a variable
grouped by another variable.
}
\examples{
# Simulate data
set.seed(123)
sim_data <- data.frame(
  Subtype = sample(c("EBV", "GS", "MSI", "CIN"), 100, replace = TRUE),
  Lauren = sample(c("Diffuse", "Intestinal", "Mixed"), 100, replace = TRUE)
)

# Create percent bar plot
p <- percent_bar_plot(
  input = sim_data, x = "Subtype", y = "Lauren",
  axis_angle = 60
)
if (!is.null(p)) print(p)
}
\author{
Dongqiang Zeng
}
