alishinski / lavaanPlot

R package for plotting lavaan path models with DiagrammeR
http://alexlishinski.com/lavaanPlot/
39 stars 4 forks source link

argument to hide manifest variables #31

Closed ogansser closed 2 years ago

ogansser commented 3 years ago

Hi, I am trying to hide the manifest variables, so that I can plot only the latent variables. Which argument do I need?

Olli

alishinski commented 2 years ago

It's not possible right now, so there is no argument, but it could definitely be added, I'll put it on the to do list. In the meantime, if you need to modify a lavaanPlot diagram to omit some paths, you can always manually modify the diagram specification and get rid of paths you don't want. E.g.:

model <- " wt ~~ disp
  mpg ~ cyl + disp + hp
  qsec ~ disp + hp + wt"

fit <- sem(model, data = mtcars)
plo <- lavaanPlot(model = fit, coefs = TRUE, stand = TRUE, covs = TRUE)

# gives you the diagram specification
plo$x$diagram

# modify that and put into this function
grViz()