combine_graphs_centrality: Combine Network and Centrality Graphs

View source: R/combine_graphs_centrality.R

combine_graphs_centralityR Documentation

Combine Network and Centrality Graphs

Description

Combines a qgraph network plot with a centrality line plot.

Usage

combine_graphs_centrality(
  Figura1_Derecha,
  network,
  groups,
  error_Model,
  labels = NULL,
  abbreviate_labels = FALSE,
  ncol = 2,
  widths = c(0.5, 0.6),
  dpi = 600,
  legend.cex = 0.1,
  layoutScale = c(1, 1),
  vsize = 18,
  threshold = 0
)

Arguments

Figura1_Derecha

ggplot object with centrality plot.

network

Estimated network object.

groups

List of node communities.

error_Model

Prediction error values for pie chart overlay.

labels

Custom node labels.

abbreviate_labels

Logical; abbreviate labels to 3 characters.

ncol

Number of columns in layout.

widths

Relative widths of panels.

dpi

Resolution in dots per inch.

legend.cex

Legend text size multiplier.

layoutScale

Layout scale vector.

vsize

Node size.

threshold

Minimum edge weight threshold.

Value

A patchwork object with the network on the left and the centrality plot on the right.

Examples

set.seed(123)
n <- 300
f1 <- rnorm(n)
f2 <- 0.3 * f1 + rnorm(n)
items <- data.frame(
  sapply(1:4, function(i) 0.7 * f1 + rnorm(n, 0, 0.7)),
  sapply(1:4, function(i) 0.7 * f2 + rnorm(n, 0, 0.7))
)
names(items) <- c(paste0("A", 1:4), paste0("B", 1:4))

net <- bootnet::estimateNetwork(items, default = "EBICglasso")
g <- qgraph::qgraph(net$graph, DoNotPlot = TRUE)
cent <- centrality_plots2(g, net,
                          groups = rep(c("A", "B"), each = 4),
                          measure1 = "Bridge Expected Influence (1-step)")
r2 <- mgm_error_metrics(items, type = rep("g", 8), level = rep(1, 8))$R2
combine_graphs_centrality(cent$plot, net, groups = list(A = 1:4, B = 5:8),
                          error_Model = r2, dpi = 100)

InterconectaR documentation built on Oct. 16, 2026, 1:06 a.m.