View source: R/qgraph_centrality_panel.R
| qgraph_centrality_panel | R Documentation |
Create a combined panel with qgraph network and centrality plot
qgraph_centrality_panel(
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,
legend_title = "Métrica",
keep_centrality_scale = TRUE,
layoutScale = c(0.9, 0.9),
GLratio = 2,
vsize = 18,
esize = 18,
node.width = 0.8,
curveAll = 2,
palette = "pastel",
layout = "spring",
edge.labels = TRUE,
edge.label.cex = 1
)
Figura1_Derecha |
A ggplot object for the right panel (centrality plot). |
network |
A network object with elements |
groups |
Named list mapping factor names to node indices. |
error_Model |
Pie values for error model visualization. |
labels |
Optional character vector of node labels. |
abbreviate_labels |
Logical; abbreviate labels to 3 characters. |
ncol |
Number of columns in the layout. |
widths |
Relative widths of the panels. |
dpi |
Resolution in DPI for the qgraph rendering. |
legend.cex |
Legend text size for qgraph. |
legend_title |
Title for the legend. |
keep_centrality_scale |
Logical; keep original scale of centrality plot. |
layoutScale |
Numeric vector of length 2 for layout scaling. |
GLratio |
Graph-to-legend ratio. |
vsize |
Node size. |
esize |
Edge size. |
node.width |
Node width. |
curveAll |
Edge curvature. |
palette |
Color palette name. |
layout |
Layout algorithm. |
edge.labels |
Logical; show edge labels. |
edge.label.cex |
Edge label text size. |
A combined patchwork plot object.
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
qgraph_centrality_panel(cent$plot, net, groups = list(A = 1:4, B = 5:8),
error_Model = r2, dpi = 100)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.