% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sequence_compare.R
\name{plot.net_sequence_comparison}
\alias{plot.net_sequence_comparison}
\title{Plot Method for net_sequence_comparison}
\usage{
\method{plot}{net_sequence_comparison}(
  x,
  top_n = 10L,
  style = c("pyramid", "heatmap"),
  sort = c("statistic", "frequency"),
  alpha = 0.05,
  show_residuals = FALSE,
  ...
)
}
\arguments{
\item{x}{A \code{net_sequence_comparison} object.}

\item{top_n}{Integer. Show top N patterns. Default: 10.}

\item{style}{Character. \code{"pyramid"} (default) or \code{"heatmap"}.}

\item{sort}{Character. \code{"statistic"} (default) ranks patterns by test
statistic or residual magnitude. \code{"frequency"} ranks by total
occurrence count across all groups.}

\item{alpha}{Numeric. Significance threshold for p-value display in the
pyramid. Default: 0.05.}

\item{show_residuals}{Logical. If \code{TRUE}, print the standardized
residual value inside each pyramid bar. Default: \code{FALSE}. Ignored
for the heatmap (which always shows residuals).}

\item{...}{Additional arguments (ignored).}
}
\value{
A \code{ggplot} object, invisibly.
}
\description{
Visualizes pattern-level standardized residuals across groups. Two styles
are available:
\describe{
\item{\code{"pyramid"}}{Back-to-back bars of pattern proportions, shaded
by each side's standardized residual. Requires exactly 2 groups.}
\item{\code{"heatmap"}}{One tile per (pattern, group) cell, colored by
standardized residual. Works for any number of groups.}
}
Residuals are read directly from the \code{resid_<group>} columns in
\code{$patterns}, which are always populated regardless of the inference
method chosen in \code{sequence_compare}.
}
\examples{
seqs <- data.frame(
  V1 = sample(LETTERS[1:4], 60, TRUE),
  V2 = sample(LETTERS[1:4], 60, TRUE),
  V3 = sample(LETTERS[1:4], 60, TRUE),
  V4 = sample(LETTERS[1:4], 60, TRUE)
)
grp <- rep(c("X", "Y"), 30)
net <- build_network(seqs, method = "relative")
res <- sequence_compare(net, group = grp, sub = 2:3, test = "chisq")

}
