Unexpected lines appearing in Confirmatory Factor Analysis diagram using SemPlot

I’m having trouble with my SemPlot diagram. It’s showing weird lines next to the labels for the observed variables. I’ve tried adjusting the settings, but I can’t get rid of them. Here’s the code I’m using:

semPlot::semPaths(cfa_model, residuals = TRUE, what = "std", 
                  label.cex = 1, edge.label.cex = 0.5, 
                  fade = FALSE, intercepts = FALSE, 
                  curveAdjacent = TRUE, title = FALSE, 
                  layout = "tree2", sizeMan = 7, 
                  curvePivot = TRUE, borders = FALSE, 
                  nCharNodes = 0, nCharEdges = 0,
                  nodeLabels = paste0("OV", 1:14))

Has anyone else run into this issue? Any ideas on how to fix it? I’d really appreciate some help figuring out why these lines are showing up and how to remove them. Thanks!

Hey BrilliantCoder23! Those pesky lines can be a real head-scratcher, right? :sweat_smile: I’ve had my fair share of battles with SemPlot diagrams too.

Have you considered tweaking the ‘edge.color’ parameter? Sometimes setting it to a very light color or even ‘transparent’ can make those lines less noticeable without messing up your overall layout.

Also, I’m curious - what kind of data are you working with? Sometimes the nature of the variables can affect how these diagrams render. Mind sharing a bit more about your project?

Oh, and here’s a random thought - have you tried using a different plotting package like ‘ggplot2’ with ‘ggdag’? It might give you more control over those little details. Just a thought!

Keep us posted on how it goes. I’m really interested to see what solution you end up with!

hey there BrilliantCoder23! i’ve seen this before. those lines are probably standardized residuals. try adding ‘residuals = FALSE’ to ur semPaths function. that should get rid of em. if not, maybe play around with the ‘edge.label.cex’ parameter. hope this helps!

I encountered a similar issue when working with SemPlot recently. The unexpected lines are indeed standardized residuals, as LeoNinja22 mentioned. However, setting ‘residuals = FALSE’ didn’t fully resolve the problem for me.

What worked in my case was adjusting the ‘edge.label.cex’ parameter to a smaller value, around 0.3, and combining it with ‘residuals = FALSE’. Additionally, I found that using ‘layout = “circle”’ instead of ‘tree2’ helped clean up the diagram significantly.

Here’s the modified code that solved it for me:

semPlot::semPaths(cfa_model, residuals = FALSE, what = "std", 
                  label.cex = 1, edge.label.cex = 0.3, 
                  fade = FALSE, intercepts = FALSE, 
                  curveAdjacent = TRUE, title = FALSE, 
                  layout = "circle", sizeMan = 7, 
                  curvePivot = TRUE, borders = FALSE, 
                  nCharNodes = 0, nCharEdges = 0,
                  nodeLabels = paste0("OV", 1:14))

Give it a try and see if it resolves the issue for you as well.