% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/plot-centrality.R
\name{plot_centrality}
\alias{plot_centrality}
\title{Plot Centrality}
\usage{
plot_centrality(
  x,
  measures = NULL,
  style = c("line", "bar", "lollipop", "dot"),
  orientation = c("horizontal", "vertical"),
  scale = c("raw", "normalized", "z", "rank"),
  order_by = NULL,
  top_n = NULL,
  highlight = 0L,
  cluster = NULL,
  palette = "cograph",
  ncol = NULL,
  title = NULL,
  subtitle = NULL,
  ...
)
}
\arguments{
\item{x}{Output of \code{\link{centrality}}, or any network input
(matrix, igraph, cograph_network, tna, netobject).}

\item{measures}{Character vector of measure names. Default pulls the
classical five (degree, strength, betweenness, closeness, eigenvector)
when \code{x} is a network; default \code{NULL} keeps all columns
when \code{x} is already a centrality data frame.}

\item{style}{Character: "line" (default), "bar", "lollipop", or "dot".}

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

\item{scale}{Character: "raw" (default, native units; in the "line"
style this forces free y-axis per measure via faceting), "normalized" ([0, 1]
within measure), "z" (standardized within measure), or "rank"
(1..n, highest value = 1).}

\item{order_by}{Character. For "bar"/"lollipop": which measure sorts
nodes. Defaults to the first measure. Use \code{"alpha"} for
alphabetical. For "line", this also controls node ordering unless
\code{"alpha"} is requested.}

\item{top_n}{Optional integer to keep only the top-N nodes (by
\code{order_by}). Useful for large graphs.}

\item{highlight}{Optional integer: highlight the top-N bars/lines per
measure in full color; mute the rest. Default 0 (no highlighting).}

\item{cluster}{Optional named vector or data-frame column mapping each
node to a cluster/community. Colors nodes by cluster when supplied.}

\item{palette}{Character or vector. \code{"cograph"} (default) uses
cograph's teal-gold-leaf palette; \code{"okabe"} uses Okabe-Ito;
\code{"viridis"} uses viridis; or supply a character vector of colors.}

\item{ncol}{For faceted styles ("bar", "lollipop"): number of columns.
Default \code{NULL} chooses sensibly based on measure count.}

\item{title}{Plot title. Default NULL.}

\item{subtitle}{Plot subtitle. Default NULL.}

\item{...}{Passed to \code{\link{centrality}} when \code{x} is a network.}
}
\value{
A ggplot object.
}
\description{
Publication-quality visualization of one or more centrality measures.
Accepts the data frame from \code{\link{centrality}} directly or any
network input.
}
\details{
Four styles are available:
\describe{
\item{\code{"line"}}{Faceted line view with one panel per measure.
Nodes are ordered along the requested orientation and connected within
each measure.}
\item{\code{"bar"}}{Horizontal bars, one facet per measure. Best for
reading individual measure values.}
\item{\code{"lollipop"}}{Like \code{"bar"} but with a dot at the tip.
Softer visual weight; useful on dense grids.}
\item{\code{"dot"}}{Dot-only variant of the lollipop style.}
}
}
\examples{
adj <- matrix(c(0,1,1,0,0, 1,0,1,1,0, 1,1,0,1,1, 0,1,1,0,1, 0,0,1,1,0),
              5, 5)
rownames(adj) <- colnames(adj) <- LETTERS[1:5]
plot_centrality(adj)
plot_centrality(adj, style = "bar", highlight = 2)
}
