| lav_plotinfo_positions {lavaan} | R Documentation |
Position the nodes in the diagram
Description
Computes the positions for the nodes and anchors and control points for the edges in the diagram.
Usage
lav_plotinfo_positions(plotinfo,
placenodes = NULL,
edgelabelsbelow = NULL,
group.covar.indicators = FALSE)
Arguments
plotinfo |
The plotinfo structure as returned from |
placenodes |
optional list with members |
edgelabelsbelow |
optional list with members |
group.covar.indicators |
logical, should items with indicators which have an explicit covariance link be placed in the same group, i.e. forced to be on the same side of the diagram? |
Details
This function tries to arrange the nodes and anchor points for the edges in
a way that gives a not-to-large diagram and taking into account the voorkeur
column in the input nodes data.frame. If the result is not what you want, you can
take a look at the plot via lav_plotinfo_rgraph or lav_plot functions and
decide yourself to place some nodes at another location (placenodes)
and/or put some edge labels at the other side of the edge (labelsbelow).
For multilevel models – maximum two levels – the nodes in block 2 are grouped
at the top of the diagram and those in block 1 at the bottom. The item
mlrij gives the position of the separation between the blocks.
Value
A plotinfo strucure with modified nodes and edges
data.frames, and an integer mlrij giving the position at which a line
should be drawn for multilevel models.
The data.frames have new columns defined as follows:
-
nodes- rij
index of the row where the node will be placed, initialized NA.
- kolom
index of the column where the node will be placed, initialized NA.
-
edges- vananker
character, anchor point for starting node, initialized NA.
- naaranker
character, anchor point for destination node, initialized NA.
- controlpt.kol
real, column position of control point if the edge has to be drawn as a quadratic Beziers curve.
- controlpt.row
real, row position of control point if the edge has to be drawn as a quadratic Beziers curve.
- labelbelow
logical, TRUE if label has to be positioned under the line, initalized FALSE.
See Also
lav_model_plotinfo, lav_plotinfo_rgraph,
lav_plot
Examples
model <- 'alfa =~ 1 * x1 + x2 + x3 # latent variable
beta <~ x4 + x5 + x6 # composite
gamma =~ 1 * x7 + x8 + x9 # latent variable
Xi =~ 1 * x10 + x11 + x12 + x13 # latent variable
# regressions
Xi ~ v * alfa + t * beta + cc * 1
alfa ~ tt * beta + ss * gamma + yy * Theta1
# variances and covariances
x2 ~~ cc25 * x5
x3 ~~ cc36 * x6
x3 ~~ cc34 * x4
gamma ~~ 0.55 * gamma
'
test <- lav_model_plotinfo(model)
(test_positioned <- lav_plotinfo_positions(test))