View source: R/plot_latent_network_diagram.R
| plot_latent_network_diagram | R Documentation |
Plot a latent network diagram (SEM path diagram)
plot_latent_network_diagram(
model_object,
filename,
output_path = NULL,
width = 9.5,
height = 6.5,
resolution = 1500,
node_labels = NULL,
color_scheme = NULL,
color_palette = "auto",
plot_settings = NULL,
device_settings = NULL,
edge_settings = NULL,
save_message = TRUE,
show_manifest = TRUE
)
model_object |
A fitted model: a |
filename |
Output filename (with extension .png, .jpg, or .pdf). |
output_path |
Directory where the file is written. It has no default,
so nothing is written unless you choose a location (use |
width |
Plot width in inches. |
height |
Plot height in inches. |
resolution |
Plot resolution in DPI. |
node_labels |
Optional character vector of node labels. |
color_scheme |
Optional list with elements |
color_palette |
Color palette type (default: "auto"). |
plot_settings |
Optional list of semPaths plot settings. |
device_settings |
Optional list of device settings. |
edge_settings |
Optional list of edge display settings. |
save_message |
Logical; report the path of the saved file as a message (default: TRUE). |
show_manifest |
Logical; show manifest variables (default: TRUE). |
Invisibly, the path of the saved file. Called for its side effect:
the diagram is written to file.path(output_path, filename).
set.seed(123)
n <- 300
f1 <- rnorm(n)
f2 <- 0.3 * f1 + rnorm(n)
items <- data.frame(
sapply(1:4, function(i) 0.7 * f1 + rnorm(n, 0, 0.7)),
sapply(1:4, function(i) 0.7 * f2 + rnorm(n, 0, 0.7))
)
names(items) <- c(paste0("A", 1:4), paste0("B", 1:4))
fit <- lavaan::cfa("F1 =~ A1 + A2 + A3 + A4
F2 =~ B1 + B2 + B3 + B4", data = items)
plot_latent_network_diagram(fit, filename = "diagram.png",
output_path = tempdir(), resolution = 100)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.