View source: R/plot-centrality.R
| plot_centrality_compare | R Documentation |
Compare a centrality measure across two or more groups using stacked,
faceted, grouped, dumbbell, line, or two-group pyramid layouts. The
"pyramid" style is a back-to-back horizontal bar chart for exactly
two groups.
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()
)
... |
Two or more centrality data frames (from
|
measure |
Character, a single centrality measure to compare. If NULL, the first shared measure is used. |
style |
Character: |
group_labels |
Character vector with one label per group. Default
|
group_colors |
Character vector of colors, one per group. Default cycles through the cograph palette. |
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 ( |
sort_by |
|
top_n |
Show top N nodes (by |
scale |
|
show_values |
Logical. Print the value inside each bar. Default TRUE. |
size_by_value |
Logical. For |
size_range |
Numeric vector of length 2 giving the min and max
dot size (mm) when |
orientation |
Character: |
ncol |
Number of facet columns for |
title |
Plot title. |
subtitle |
Plot subtitle. Auto-generated when NULL. |
centrality_args |
Named list of additional arguments passed to
|
A ggplot object.
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"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.