View source: R/change_node_label.R
change_node_label | R Documentation |
Change the labels of selected nodes.
change_node_label(
semPaths_plot,
label_list = NULL,
label.cex,
label.scale,
label.prop,
label.norm
)
semPaths_plot |
A qgraph::qgraph object generated by semPlot::semPaths, or a similar qgraph object modified by other semptools functions. |
label_list |
A list of named lists. Each named list should
have two named values: |
label.cex |
Identical to the same argument in
|
label.scale |
Identical to the same argument in
semPlot::semPaths. A logical value that determine whether labels
wil be scaled (resized) to the nodes they attach to. It has no
default. If not set, then this option in the |
label.prop |
Identical to the same argument in
semPlot::semPaths. A numeric vector of length equal to the number
of nodes. If |
label.norm |
Identical to the same argument in
semPlot::semPaths. It must be a string. All labels as wide as or
narrower than this string will have the same font size, while all
labels wider than this string will be rescaled to have the same
width as this string. It has no default. If not set, then this
option in the |
Modify a qgraph::qgraph object generated by semPlot::semPaths and change the labels of selected nodes.
A qgraph::qgraph based on the original one, with node attributes of selected nodes modified.
library(semPlot)
library(lavaan)
mod_pa <-
'x1 ~~ x2
x3 ~ x1 + x2
x4 ~ x1 + x3
'
fit_pa <- sem(mod_pa, pa_example)
parameterEstimates(fit_pa)[, c("lhs", "op", "rhs", "est", "pvalue")]
m <- matrix(c("x1", NA, NA,
NA, "x3", "x4",
"x2", NA, NA), byrow = TRUE, 3, 3)
p_pa <- semPaths(fit_pa, whatLabels="est",
style = "ram",
nCharNodes = 0, nCharEdges = 0,
layout = m)
my_label_list <- list(list(node = "x3", to = "mediator"),
list(node = "x4", to = expression(gamma)))
p_pa2 <- change_node_label(p_pa, my_label_list)
plot(p_pa2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.