% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/plot_att_gt.R
\name{plot_att_gt}
\alias{plot_att_gt}
\alias{autoplot.att_gt_result}
\title{Plot the ATT(g,t) matrix from a Callaway-Sant'Anna event study}
\usage{
plot_att_gt(
  x,
  type = c("heatmap", "facet"),
  ci_level = 0.95,
  zero_line = TRUE,
  theme = c("bw", "minimal", "classic"),
  color = "#B25D91FF",
  fill = "#B25D91FF",
  alpha = 0.2
)

\method{autoplot}{att_gt_result}(object, ...)
}
\arguments{
\item{x}{An \code{es_result} object returned by
\code{run_es(estimator = "cs")}, or an \code{att_gt_result} data frame
produced by extracting \code{attr(x, "att_gt")} and giving it class
\code{"att_gt_result"}.}

\item{type}{\code{"heatmap"} (default) or \code{"facet"}.}

\item{ci_level}{Confidence level for pointwise intervals (default 0.95).}

\item{zero_line}{Logical; draw a horizontal reference line at zero in the
\code{"facet"} display (default \code{TRUE}).}

\item{theme}{One of \code{"bw"} (default), \code{"minimal"}, or
\code{"classic"}.}

\item{color}{Line and point colour used in the \code{"facet"} display
(default \code{"#B25D91FF"}, matching \code{plot_es}).}

\item{fill}{Ribbon fill colour in the \code{"facet"} display (default
\code{"#B25D91FF"}).}

\item{alpha}{Ribbon transparency in the \code{"facet"} display
(default \code{0.2}).}

\item{object}{An \code{att_gt_result} object (extracted from an
\code{es_result} via \code{attr(result, "att_gt")}).}

\item{...}{Passed to \code{\link{plot_att_gt}}.}
}
\value{
A \code{\link[ggplot2]{ggplot}} object.
}
\description{
Visualises the full cohort-by-period ATT(g,t) matrix stored in the
\code{att_gt} attribute of an \code{es_result} object produced by
\code{run_es(estimator = "cs")}.  Two display styles are available:

\itemize{
  \item \code{"heatmap"}: a tile plot with calendar time \eqn{t} on the
    x-axis and cohort \eqn{g} on the y-axis, colour-filled by the point
    estimate.  Cells whose pointwise confidence interval excludes zero are
    marked with a filled dot; cells that are simultaneously significant
    (when bootstrap data are available) are additionally marked with an open
    diamond.
  \item \code{"facet"}: one panel per cohort showing ATT(g,t) over
    calendar time \eqn{t} with a pointwise confidence ribbon, mirroring
    the style of \code{\link{plot_es}}.  A lighter simultaneous CI ribbon
    is overlaid when bootstrap data are available.
}

Both types draw a vertical dashed line at \eqn{t = g} (treatment onset)
for each cohort.
}
\section{Bootstrap annotation}{

When \code{attr(x, "bootstrap")} is present (i.e., \code{run_es()} was
called with \code{bootstrap = TRUE}), both plot types add simultaneous
inference overlays sourced from the (g,t)-level bootstrap object.
}

\examples{
\dontrun{
cs_result <- run_es(data = mydata, outcome = y, time = year,
                    timing = g, unit = id, fe = ~id + year,
                    staggered = TRUE, estimator = "cs")
plot_att_gt(cs_result)
plot_att_gt(cs_result, type = "facet")
}

}
\seealso{
\code{\link{plot_es}}, \code{\link{run_es}}
}
