% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/motifs-api.R
\name{plot_motifs}
\alias{plot_motifs}
\title{Plot a motif/subgraph result}
\usage{
plot_motifs(
  x,
  type = c("triads", "types", "significance", "patterns"),
  n = 15,
  ncol = 5,
  colors = c("#2166AC", "#B2182B"),
  node_size = 5,
  label_size = 11,
  title_size = 12,
  stats_size = 13,
  legend_size = 13,
  legend = TRUE,
  motif_color = "#800020",
  spacing = 1,
  base_size = 12,
  ...
)
}
\arguments{
\item{x}{A \code{cograph_motif_result} object from \code{motifs()} or
\code{subgraphs()}.}

\item{type}{Plot type:
\describe{
\item{\code{"triads"}}{Network diagrams of specific node triples
(instance mode) or falls back to patterns (census mode). Each panel
title reads \code{"<MAN code>: <description>"} (e.g. \code{"030T:
      Feed-forward"}) and, in census mode, appends the z-score and a
significance star (\code{*} p<.05, \code{**} p<.01, \code{***}
p<.001). Arranged in a grid.}
\item{\code{"types"}}{Bar chart of MAN type frequencies. In census
mode bars are colored by significance direction (see \code{colors});
in instance mode bars use a single fill because per-type
significance would need an aggregation rule across multiple
node-triple rows of the same type.}
\item{\code{"significance"}}{Z-score bars per row of
\code{x$results}. In census mode each bar is one MAN type; in
instance mode each bar is one concrete node-triple, labeled
\code{"<triple> [<MAN code>: <description>]"}. Bars are colored
with the same three-tone rule (see \code{colors}). Requires
\code{significance = TRUE} in the \code{motifs()} call.}
\item{\code{"patterns"}}{Abstract MAN pattern diagrams showing the
edge structure of each triad type. In census mode panel nodes are
filled by significance direction (red sig over / blue sig under /
grey ns); in instance mode panels use a single fill, same reason
as \code{"types"}.}
}}

\item{n}{Maximum number of items to plot. Default 15.}

\item{ncol}{Number of columns in the triad/pattern grid. Default 5.}

\item{colors}{Two-element color vector mapped to a three-tone
significance scale (used by \code{type = "significance"}, plus
\code{type = "types"} and \code{type = "patterns"} in census mode):
\code{colors[1]} fills items that are significantly under-represented
(\code{p < .05} and \code{z < 0}); \code{colors[2]} fills items that
are significantly over-represented (\code{p < .05} and \code{z > 0});
everything else is filled neutral grey (\code{"#9E9E9E"}). Default
\code{c("#2166AC", "#B2182B")} (blue for under, red for over).
When significance was not run, \code{type = "types"} falls back to a
single \code{colors[1]} fill and patterns nodes use \code{colors[1]}.}

\item{node_size}{Triad node radius (relative). Default 5.
(\code{type = "triads"} only.)}

\item{label_size}{Triad node-label font size in points. Default 11.}

\item{title_size}{Per-panel title font size in points. Default 12.}

\item{stats_size}{Per-panel statistics caption font size in points
(e.g., \code{n=34 z=-55.3 p<.001}). Default 13.}

\item{legend_size}{Bottom legend font size in points. Default 13.}

\item{legend}{Logical. Show the abbreviation legend strip below the
triad grid. Default \code{TRUE}. (\code{type = "triads"} only.)}

\item{motif_color}{Color of triad nodes/edges/labels. Default
\code{"#800020"} (deep burgundy). (\code{type = "triads"} only.)}

\item{spacing}{Triangle spread inside each panel; \code{> 1} pulls
nodes inward, \code{< 1} pushes them apart. Default 1.}

\item{base_size}{Base font size for the \code{ggplot2} themes used
by \code{type = "types"} and \code{type = "significance"}.
Default 12.}

\item{...}{Additional arguments passed to internal plot helpers.}
}
\value{
Invisibly returns the input \code{x} (or the underlying
\code{ggplot} for the \code{"types"} and \code{"significance"}
types, matching the S3 method).
}
\description{
Tab-completion-friendly wrapper around the
\code{plot.cograph_motif_result} S3 method. Functionally identical
to \code{plot(x, ...)} on a \code{cograph_motif_result} object,
but exposes the \code{type / n / ncol / colors} arguments to
editor autocompletion.
}
\examples{
\dontshow{if (requireNamespace("igraph", quietly = TRUE)) withAutoprint(\{ # examplesIf}
g <- igraph::sample_gnp(20, 0.2, directed = TRUE)
m <- motifs(g)
plot_motifs(m)
plot_motifs(m, type = "types")
\dontshow{\}) # examplesIf}
}
\seealso{
\code{\link{motifs}}, \code{\link{subgraphs}}
}
