Faceted bar plot of node-level centralities, one panel per measure,
drawn with 'ggplot2' (Suggests). Mirrors the look of
tna::plot.tna_centralities().
Arguments
- x
An htna network,
htna_group, orhtna_centralitiesdata frame fromcentralities_htna().- measures
Centralities to plot. Default: all nine.
- by
"state"(default) gives each node its own colour;"group"colours by actor group (Human, AI, ...) using htna_palette.- reorder
If
TRUE, sort nodes by value within each measure.- ncol
Number of facet columns. Default
3.- scales
Facet scaling:
"free_x"(default) or"fixed".- colors
Optional fill colours, recycled per group/node.
- labels
If
TRUE(default), draw the value next to each bar.- ...
Forwarded to
centralities_htna()when computing on the fly.
Details
Accepts an htna network, an htna_group, or a data frame produced by
centralities_htna(). For an htna_group the bars are replaced by one
line-and-point profile per cohort in each panel (colour = cohort), so
cohort differences on a measure read along the same node axis; by is
then not used.
Examples
if (requireNamespace("ggplot2", quietly = TRUE)) {
data(human_ai)
net <- build_htna(human_ai, actor_type = "actor_type")
plot_centralities(net)
plot_centralities(net, by = "group")
grp <- build_htna(human_ai, actor_type = "actor_type", group = "phase")
plot_centralities(grp)
}
#> Metadata aggregated per session: ties resolved by first occurrence in 'session_date' (1 sessions), 'cluster' (42 sessions), 'actor_type' (24 sessions)
#> Note: Weights inverted (1/w^1) for path-based measures (invert_weights=TRUE). Higher weights = shorter paths.
#> Note: Weights inverted (1/w^1) for path-based measures (invert_weights=TRUE). Higher weights = shorter paths.
#> Note: Weights inverted (1/w^1) for path-based measures (invert_weights=TRUE). Higher weights = shorter paths.
#> Note: Weights inverted (1/w^1) for path-based measures (invert_weights=TRUE). Higher weights = shorter paths.
#> Note: Weights inverted (1/w^1) for path-based measures (invert_weights=TRUE). Higher weights = shorter paths.
#> Note: Weights inverted (1/w^1) for path-based measures (invert_weights=TRUE). Higher weights = shorter paths.
#> Note: Weights inverted (1/w^1) for path-based measures (invert_weights=TRUE). Higher weights = shorter paths.
#> Note: Weights inverted (1/w^1) for path-based measures (invert_weights=TRUE). Higher weights = shorter paths.
#> Metadata aggregated per session: ties resolved by first occurrence in 'cluster' (24 sessions), 'actor_type' (9 sessions)
#> Metadata aggregated per session: ties resolved by first occurrence in 'session_date' (1 sessions), 'cluster' (18 sessions), 'actor_type' (15 sessions)
#> Note: Weights inverted (1/w^1) for path-based measures (invert_weights=TRUE). Higher weights = shorter paths.
#> Note: Weights inverted (1/w^1) for path-based measures (invert_weights=TRUE). Higher weights = shorter paths.
#> Note: Weights inverted (1/w^1) for path-based measures (invert_weights=TRUE). Higher weights = shorter paths.
#> Note: Weights inverted (1/w^1) for path-based measures (invert_weights=TRUE). Higher weights = shorter paths.
#> Note: Weights inverted (1/w^1) for path-based measures (invert_weights=TRUE). Higher weights = shorter paths.
#> Note: Weights inverted (1/w^1) for path-based measures (invert_weights=TRUE). Higher weights = shorter paths.
#> Note: Weights inverted (1/w^1) for path-based measures (invert_weights=TRUE). Higher weights = shorter paths.
#> Note: Weights inverted (1/w^1) for path-based measures (invert_weights=TRUE). Higher weights = shorter paths.
