Creates code to draw a diagram in tikz or svg, plots the diagram, or stores the diagram in a png file.
lav_plot(model = NULL,
infile = NULL,
varlv = FALSE,
placenodes = NULL,
edgelabelsbelow = NULL,
group_covar_indicators = FALSE,
common_opts = list(sloped_labels = TRUE,
mlovcolors = c("lightgreen", "lightblue"),
italic = TRUE,
lightness = 1,
auto_subscript = TRUE),
rplot = list(outfile = "",
addgrid = TRUE),
tikz = list(outfile = "",
cex = 1.3,
standalone = FALSE),
svg = list(outfile = "",
stroke_width = 2L,
font_size = 20L,
idx_font_size = 15L,
dy = 5L,
font_family = "Latin Modern Math, arial, Arial, sans",
standalone = FALSE)
)NULL, invisible
A character vector specifying the model in lavaan syntax or a list
(or data.frame) with at least members lhs, op, rhs, label and fixed or a fitted
lavaan object (in which case the ParTable object is extracted and column
est is used as value to show).
Should be NULL if infile is given.
A character string specifying the file that contains the model syntax.
A logical indicating that the (residual) variance of a variable should be plotted as a separate latent variable (with a smaller circle than ordinary latent variables). In this case, a covariance between two such variables is plotted as a covariance between their variance latent variables.
optional list with members nodename = c(row, column),
row and column don't have to be integers.
optional list with members c(nodename1,
nodename2).
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?
options common to the three types of generated plots.
options for creating Rplot,
see lav_plotinfo_rgraph.
options for creating code for tikz plot,
see lav_plotinfo_tikzcode.
options for creating code for svg plot,
see lav_plotinfo_svgcode.
If rplot is specified, or if neither tikz nor svg is
specified, an R plot is generated, and stored in a png file if the outfile
member of rplot is set. If tikz is specified, the code for a tikz
diagram is stored in the specified outfile; the same applies to svg.
The lav_plot command tries to create a nice plot from the input model,
but the variable names should be kept short, and the nodes in the plot may
sometimes need to be rearranged. As an example, the (slightly modified) example
of the sem function in lavaan produces the first plot shown below.
Using the placenodes argument produces the second plot.
More details on the parameters can be found in the help for
the lav_... functions.
lav_model_plotinfo, lav_plotinfo_positions,
lav_plotinfo_rgraph, lav_plotinfo_tikzcode,
lav_plotinfo_svgcode