View source: R/centrality_bullet_plot.R
| centrality_bullet_plot | R Documentation |
Crea un grafico tipo Bullet Chart para visualizar dos metricas de centralidad (por ejemplo, Strength y Bridge Strength) de forma compacta y comparativa.
centrality_bullet_plot(
qgraph_obj,
network,
groups = NULL,
measure0 = "Strength",
measure1 = "Bridge Strength",
color_bar = "#3498DB",
color_marker = "#E74C3C",
color_background = "#ECF0F1",
bar_height = 0.6,
marker_size = 4,
use_abbrev = TRUE,
labels = NULL,
order_by = "measure0",
show_values = TRUE,
text_size = 11
)
qgraph_obj |
Objeto qgraph creado previamente. |
network |
Objeto de red estimado (por ejemplo, de bootnet::estimateNetwork). |
groups |
Lista de grupos/comunidades para calcular metricas de puente. |
measure0 |
Metrica principal (barra). Default: "Strength". |
measure1 |
Metrica secundaria (linea marcador). Default: "Bridge Strength". |
color_bar |
Color de la barra principal. Default: "#3498DB". |
color_marker |
Color del marcador de referencia. Default: "#E74C3C". |
color_background |
Color de fondo de la barra. Default: "#ECF0F1". |
bar_height |
Altura de las barras (0-1). Default: 0.6. |
marker_size |
Tamano del marcador triangular. Default: 4. |
use_abbrev |
Usar nombres abreviados. Default: TRUE. |
labels |
Vector de etiquetas personalizadas para los nodos. Default: NULL. |
order_by |
Ordenar por: "measure0", "measure1", "name". Default: "measure0". |
show_values |
Mostrar valores numericos. Default: TRUE. |
text_size |
Tamano del texto de los nodos. Default: 11. |
Lista con dos elementos:
plot |
Objeto ggplot con el Bullet Chart. |
table |
Tabla con los valores de centralidad. |
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)
result <- centrality_bullet_plot(
qgraph_obj = g,
network = net,
groups = rep(c("A", "B"), each = 4),
measure0 = "Strength",
measure1 = "Bridge Strength"
)
result$plot
result$table
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.