Extracts the network, the layout and the plotting arguments from a qgraph
object and passes them to a cograph plotting engine. Node, edge and graph
settings are read from the resolved graphAttributes of the object.
The colors posCol, negCol and the theme are read from
its Arguments.
Usage
from_qgraph(
qgraph_object,
engine = c("splot", "soplot"),
plot = TRUE,
weight_digits = 2,
show_zero_edges = FALSE,
preserve_node_size = FALSE,
...
)Arguments
- qgraph_object
Return value of
qgraph::qgraph()- engine
Which cograph renderer to use:
"splot"or"soplot". Default:"splot".- 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 whose weight rounds to zero at this precision are dropped unless
show_zero_edges = TRUE.- show_zero_edges
Logical. A zero weight means that the edge is absent, so an edge whose weight rounds to zero at
weight_digitsis dropped. WithTRUEeach such edge is plotted at the smallest magnitude thatweight_digitscan express, with its original sign. Other weights are unchanged. Default:FALSE.- preserve_node_size
Logical. If TRUE, use the node sizes extracted from the qgraph object. Default FALSE uses cograph's standard sizing.
- ...
Overrides for any extracted parameter, given by cograph name (for example
threshold). The qgraph namesminimumandcutare translated tothresholdandedge_cutoff.
Value
Invisibly, a named list of plotting parameters (the weight matrix
x, weight_digits, the layout and the extracted node, edge
and graph settings, after the overrides in ...). It can be passed
to splot() with do.call(). An input without an
Arguments field that does not inherit from "qgraph" raises
an error.
Details
Parameter Mapping
The following qgraph parameters are extracted and mapped to their cograph equivalents.
Node properties:
labels/names->labelscolor->node_fillwidth->node_size(scaled by 1.3x) whenpreserve_node_size = TRUEshape->node_shape(mapped to cograph equivalents)border.color->node_border_colorborder.width->node_border_widthlabel.cex->label_sizelabel.color->label_color
Edge properties:
labels->edge_labelslabel.cex->edge_label_size(scaled by 0.5x)lty->edge_style(numeric to name conversion)curve->curvature(only when qgraph resolved a single curvature for the whole graph)asize->arrow_size(scaled by 0.3x)edge.label.position->edge_label_position
Graph properties:
minimum->thresholdmaximum->maximumgroups->groupsdirected->directedposCol/negCol->edge_positive_color/edge_negative_colortheme->theme
Pie and donut:
pievalues->donut_fillwithdonut_inner_ratio = 0.8anddonut_empty = FALSEpieColor->donut_color
Examples
q <- qgraph::qgraph(regulation_net, DoNotPlot = TRUE)
from_qgraph(q)
