% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/plot-centrality.R
\name{plot_centrality_compare}
\alias{plot_centrality_compare}
\title{Plot Centrality Comparison}
\usage{
plot_centrality_compare(
  ...,
  measure = NULL,
  style = c("stacked", "facet", "grouped", "dumbbell", "line", "pyramid"),
  group_labels = NULL,
  group_colors = NULL,
  node_colors = NULL,
  sort_by = c("max", "delta", "first", "alpha"),
  top_n = NULL,
  scale = c("raw", "normalized"),
  show_values = TRUE,
  size_by_value = FALSE,
  size_range = c(2, 9),
  orientation = c("horizontal", "vertical"),
  ncol = NULL,
  title = NULL,
  subtitle = NULL,
  centrality_args = list()
)
}
\arguments{
\item{...}{Two or more centrality data frames (from
\code{\link{centrality}}) or network inputs. Names are used as
group labels when \code{group_labels} is NULL.}

\item{measure}{Character, a single centrality measure to compare. If
NULL, the first shared measure is used.}

\item{style}{Character: \code{"stacked"} (default), \code{"facet"},
\code{"grouped"}, \code{"dumbbell"}, \code{"line"}, or
\code{"pyramid"} (2 groups only).}

\item{group_labels}{Character vector with one label per group. Default
\code{c("Group 1", "Group 2", ...)}.}

\item{group_colors}{Character vector of colors, one per group.
Default cycles through the cograph palette.}

\item{node_colors}{Optional. Either a named character vector mapping
node name to color, an unnamed vector of colors applied in node
order, or the name of a palette (\code{"cograph"}, \code{"okabe"},
\code{"viridis"}). Used by \code{style = "facet"}.}

\item{sort_by}{\code{"max"} (default) ranks nodes by highest value
across groups; \code{"delta"} by range; \code{"first"} by first
group; \code{"alpha"} alphabetically.}

\item{top_n}{Show top N nodes (by \code{sort_by}). Default: all.}

\item{scale}{\code{"raw"} (default, native values on each side) or
\code{"normalized"} ([0, 1] within each side before plotting).}

\item{show_values}{Logical. Print the value inside each bar.
Default TRUE.}

\item{size_by_value}{Logical. For \code{"dumbbell"} style, scale dot
size by centrality value. Default FALSE.}

\item{size_range}{Numeric vector of length 2 giving the min and max
dot size (mm) when \code{size_by_value = TRUE}. Default
\code{c(2, 9)}.}

\item{orientation}{Character: \code{"horizontal"} (default, nodes on
y-axis) or \code{"vertical"} (nodes on x-axis).}

\item{ncol}{Number of facet columns for \code{style = "facet"}.
Default NULL chooses automatically.}

\item{title}{Plot title.}

\item{subtitle}{Plot subtitle. Auto-generated when NULL.}

\item{centrality_args}{Named list of additional arguments passed to
\code{\link{centrality}} when inputs are networks.}
}
\value{
A ggplot object.
}
\description{
Compare a centrality measure across two or more groups using stacked,
faceted, grouped, dumbbell, line, or two-group pyramid layouts. The
\code{"pyramid"} style is a back-to-back horizontal bar chart for exactly
two groups.
}
\examples{
set.seed(1)
m1 <- matrix(runif(25), 5, 5); diag(m1) <- 0
m2 <- matrix(runif(25), 5, 5); diag(m2) <- 0
rownames(m1) <- colnames(m1) <- LETTERS[1:5]
rownames(m2) <- colnames(m2) <- LETTERS[1:5]
plot_centrality_compare(m1, m2, measure = "strength",
                        group_labels = c("Pre", "Post"))
}
