I would like to create a single figure with multiple panels, in which each panel contains a qgraph network plot.
Ideally, I would do this:
pacman::p_load(qgraph)
# Load big5 dataset:
data(big5)
data(big5groups)
# Correlations:
Q <- qgraph(cor(big5), minimum = 0.25, cut = 0.4, vsize = 1.5, groups = big5groups,
legend = TRUE, borders = FALSE)
title("Big 5 correlations", line = 2.5)
# Same graph with spring layout:
Q2 <- qgraph(Q, layout = "spring")
title("Big 5 correlations spring", line = 2.5)
cowplot::plot_grid(Q, Q2)
But this won't work, because cowplot doesn't know how to convert the qgraph objects to grobs.
I have tried converting the qgraph objects to igraph objects, which I think I should be able to further convert to grobs, perhaps using tidygraph, ggraph, GGally, ggnetwork, or similar, but some of the information I would like to convey is lost along the way, and I already have my networks plotted just the way I want using qgraph.
It seems that there has previously been an experimental as.ggraph
function in qgraph that might have helped, but it appears that no longer exists.
My question is: Is there any way to either simply convert qgraph objects to grobs, or otherwise produce an image with several qgraph objects next to each other?