% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/plot.assoc_graph.R
\name{plot.assoc_graph}
\alias{plot.assoc_graph}
\title{Plot an Association Graph}
\usage{
\method{plot}{assoc_graph}(
  x,
  layout = NULL,
  groups = NULL,
  colors = c("lightblue", "lightyellow", "lightgreen", "lightsalmon", "plum"),
  vertex.size = 30,
  vertex.label.cex = 1.2,
  edge.width = 2,
  edge.label = NULL,
  ...
)
}
\arguments{
\item{x}{An \code{assoc_graph} object, as returned by \code{\link{assoc_graph}}.}

\item{layout}{Layout function or coordinate matrix for node positions.
Defaults to \code{\link[igraph]{layout_in_circle}} for up to 6 nodes,
\code{\link[igraph]{layout_with_fr}} otherwise.}

\item{groups}{Optional named list assigning variables to groups for coloring,
e.g., \code{list(response = "Survived", predictors = c("Class", "Sex", "Age"))}.}

\item{colors}{Character vector of colors for groups. Recycled as needed.}

\item{vertex.size}{Vertex size (default 30).}

\item{vertex.label.cex}{Label size for vertex names (default 1.2).}

\item{edge.width}{Edge width (default 2). If edge weights are present, widths are
scaled from the weights automatically.}

\item{edge.label}{Optional edge labels. If \code{TRUE} and edge weights are present,
the weight values are used as labels.}

\item{\dots}{Additional arguments passed to \code{\link[igraph]{plot.igraph}},
such as \code{main} for a title.}
}
\value{
The \code{assoc_graph} object \code{x}, returned invisibly.
}
\description{
Plot method for \code{\link{assoc_graph}} objects, displaying the association
structure of a loglinear model as a network diagram.
}
\examples{
# Basic structural plot
g <- conditional(3, factors = c("A", "B", "C")) |> assoc_graph()
plot(g, main = "Conditional independence: [AC] [BC]")

# With grouped node colors
g <- saturated(4, factors = c("A", "B", "C", "D")) |> assoc_graph()
plot(g, groups = list(c("A", "B"), c("C", "D")),
     main = "Saturated model")

}
\seealso{
\code{\link{assoc_graph}}, \code{\link[igraph]{plot.igraph}}

Other loglinear models:
\code{\link[=assoc_graph]{assoc_graph()}},
\code{\link[=get_model]{get_model()}},
\code{\link[=glmlist]{glmlist()}},
\code{\link[=joint]{joint()}},
\code{\link[=seq_loglm]{seq_loglm()}}
}
\concept{loglinear models}
