| from_qgraph | R Documentation |
Extracts the network, layout, and all relevant arguments from a qgraph
object and passes them to a cograph plotting engine. Reads resolved values
from graphAttributes rather than raw Arguments.
from_qgraph(
qgraph_object,
engine = c("splot", "soplot"),
plot = TRUE,
weight_digits = 2,
show_zero_edges = FALSE,
...
)
qgraph_object |
Return value of |
engine |
Which cograph renderer to use: |
plot |
Logical. If TRUE (default), immediately plot using the chosen engine. |
weight_digits |
Number of decimal places to round edge weights to. Default 2.
Edges that round to zero are removed unless |
show_zero_edges |
Logical. If TRUE, keep edges even if their weight rounds to zero. Default: FALSE. |
... |
Override any extracted parameter. Use qgraph-style names (e.g.,
|
The following qgraph parameters are automatically extracted and mapped to cograph equivalents:
Node properties:
labels/names -> labels
color -> node_fill
width -> node_size (scaled by 1.3x)
shape -> node_shape (mapped to cograph equivalents)
border.color -> node_border_color
border.width -> node_border_width
label.cex -> label_size
label.color -> label_color
Edge properties:
labels -> edge_labels
label.cex -> edge_label_size (scaled by 0.5x)
lty -> edge_style (numeric to name conversion)
curve -> curvature
asize -> arrow_size (scaled by 0.3x)
Graph properties:
minimum -> threshold
maximum -> maximum
groups -> groups
directed -> directed
posCol/negCol -> edge_positive_color/edge_negative_color
Pie/Donut:
pie values -> donut_fill with donut_inner_ratio=0.8
pieColor -> donut_color
edge_color and edge_width are NOT extracted because qgraph bakes its cut-based fading into these vectors, producing near-invisible edges. cograph applies its own weight-based styling instead.
The cut parameter is also not passed because it causes faint edges
with hanging labels.
Layout coordinates from qgraph are preserved with rescale=FALSE.
If you override layout, rescale is automatically re-enabled.
Invisibly, a named list of cograph parameters that can be passed to
splot() or soplot().
cograph for creating networks from scratch,
splot and soplot for plotting engines,
from_tna for tna object conversion
# Convert and plot a qgraph object
adj <- matrix(c(0, .5, .3, .5, 0, .4, .3, .4, 0), 3, 3)
q <- qgraph::qgraph(adj)
from_qgraph(q) # Plots with splot
# Use soplot engine instead
from_qgraph(q, engine = "soplot")
# Override extracted parameters
from_qgraph(q, node_fill = "steelblue", layout = "circle")
# Extract parameters without plotting
params <- from_qgraph(q, plot = FALSE)
names(params) # See what was extracted
# Works with themed qgraph objects
q_themed <- qgraph::qgraph(adj, theme = "colorblind", posCol = "blue")
from_qgraph(q_themed)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.