% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ggforestplot.R
\name{ggforestplot}
\alias{ggforestplot}
\title{Draw a ggplot2 forest plot}
\usage{
ggforestplot(
  data,
  term = "term",
  estimate = "estimate",
  conf.low = "conf.low",
  conf.high = "conf.high",
  label = term,
  group = NULL,
  grouping = NULL,
  grouping_strip_position = c("left", "right"),
  separate_groups = NULL,
  n = NULL,
  events = NULL,
  p.value = NULL,
  exponentiate = FALSE,
  sort_terms = c("none", "descending", "ascending"),
  point_size = 2.3,
  point_shape = 19,
  line_size = 0.5,
  staple_width = 0.2,
  dodge_width = 0.6,
  separate_lines = FALSE,
  separator_line_linetype = 2,
  separator_line_colour = "black",
  separator_line_size = 0.4,
  striped_rows = FALSE,
  stripe_fill = "grey95",
  stripe_colour = NA,
  zero_line = TRUE,
  zero_line_linetype = 2,
  zero_line_colour = "grey60"
)
}
\arguments{
\item{data}{Either a tidy coefficient data frame or a model object
supported by \code{\link[broom:reexports]{broom::tidy()}}.}

\item{term}{Column name holding the model term identifiers.}

\item{estimate}{Column name holding the point estimates.}

\item{conf.low}{Column name holding the lower confidence bounds.}

\item{conf.high}{Column name holding the upper confidence bounds.}

\item{label}{Optional column name used for the displayed row labels.}

\item{group}{Optional column name used for color-grouping estimates.}

\item{grouping}{Optional column name used to split rows into grouped plot
sections.}

\item{grouping_strip_position}{Positioning for grouped section strips.}

\item{separate_groups}{Optional column name used to identify labeled
variable blocks that can be outlined with grid lines.}

\item{n}{Optional column name holding sample sizes or other N labels for
table helpers.}

\item{events}{Optional column name holding event counts or event labels for
table helpers.}

\item{p.value}{Optional column name holding p-values.}

\item{exponentiate}{Logical; if \code{TRUE}, transform the estimates and draw the
axis on the log scale with the null line at 1.}

\item{sort_terms}{How to sort rows: \code{"none"}, \code{"descending"}, or
\code{"ascending"}.}

\item{point_size}{Point size for coefficient markers.}

\item{point_shape}{Shape used for coefficient markers.}

\item{line_size}{Line width for confidence intervals.}

\item{staple_width}{Width of the terminal staples on confidence interval
lines.}

\item{dodge_width}{Horizontal dodging used for grouped estimates.}

\item{separate_lines}{Logical; if \code{TRUE}, draw grid lines
around each labeled block identified by \code{separate_groups}.}

\item{separator_line_linetype}{Line type used for separator lines.}

\item{separator_line_colour}{Colour used for separator lines.}

\item{separator_line_size}{Line width used for separator lines.}

\item{striped_rows}{Logical; if \code{TRUE}, shade alternating rows.}

\item{stripe_fill}{Fill color used for shaded rows.}

\item{stripe_colour}{Border color for shaded rows.}

\item{zero_line}{Logical; if \code{TRUE}, draw a null reference line.}

\item{zero_line_linetype}{Line type for the null reference line.}

\item{zero_line_colour}{Color for the null reference line.}
}
\value{
A \code{ggplot} object. Use standard \code{ggplot2} functions such as
\code{\link[ggplot2:labs]{ggplot2::labs()}} for plot labels, and add composition helpers after
styling the main plot.
}
\description{
Builds a forest plot from standardized coefficient data or directly from a
fitted model.
}
\examples{
coefs <- data.frame(
  term = c("Age", "BMI", "Treatment"),
  estimate = c(0.10, -0.08, 0.34),
  conf.low = c(0.02, -0.16, 0.12),
  conf.high = c(0.18, 0.00, 0.56)
)

ggforestplot(coefs)

ggforestplot(coefs, striped_rows = TRUE, point_shape = 17)
}
