I am trying to draw a lavaan model using Graphviz and am happy in general with how it looks (1st graph), but would like the edge between the two dimensions to be curved but all the others to be straight.
Is it possible to get the edge between dimensions (edge d1 to d2) to curve by specifying graph [layout = neato, overlap = FALSE, outputorder = edgesfirst, splines = curved], as you can see in the second graph, but this makes all of them curved.
Could anyone guide me how to get the desired result?
Here is the code to reproduce the first graph:
grViz("
digraph CFA {
graph [layout = neato, overlap = FALSE, outputorder = edgesfirst]
node [shape = rectangle]
edge [arrowhead = vee]
# Nodes (variables)
m1 [pos = '-5,1.5!', label = 'VAR1']
m2 [pos = '-5,0.5!', label = 'VAR2']
m3 [pos = '-5,-0.5!', label = 'VAR3']
m4 [pos = '-5,-1.5!', label = 'VAR4']
d1 [pos = '-1.5,0!', label = 'Info', shape = ellipse, width=1]
d2 [pos = '1.5,0!', label = 'Support', shape = ellipse, width=1]
m5 [pos = '5,1.5!', label = 'VAR5']
m6 [pos = '5,0.5!', label = 'VAR6']
m7 [pos = '5,-0.5!', label = 'VAR7']
m8 [pos = '5,-1.5!', label = 'VAR8']
# Edges (loadings)
d1->m1 [label = '1']
d1->m2 [label = '0.82']
d1->m3 [label = '1.20']
d1->m4 [label = '0.70']
d2->m5 [label = '1']
d2->m6 [label = '0.89']
d2->m7 [label = '1.08']
d2->m8 [label = '1.15']
# Define Error
m1->m1 [label = '0.34', dir=both, tailport = 'sw', headport = 'nw', arrowhead=curve, arrowtail=curve, style=dashed]
m2->m2 [label = '0.45', dir=both, tailport = 'sw', headport = 'nw', arrowhead=curve, arrowtail=curve, style=dashed]
m3->m3 [label = '0.28', dir=both, tailport = 'sw', headport = 'nw', arrowhead=curve, arrowtail=curve, style=dashed]
m4->m4 [label = '0.98', dir=both, tailport = 'sw', headport = 'nw', arrowhead=curve, arrowtail=curve, style=dashed]
m5->m5 [label = '0.64', dir=both, tailport = 'se', headport = 'ne', arrowhead=curve, arrowtail=curve, style=dashed]
m6->m6 [label = '0.31', dir=both, tailport = 'se', headport = 'ne', arrowhead=curve, arrowtail=curve, style=dashed]
m7->m7 [label = '0.42', dir=both, tailport = 'se', headport = 'ne', arrowhead=curve, arrowtail=curve, style=dashed]
m8->m8 [label = '0.25', dir=both, tailport = 'se', headport = 'ne', arrowhead=curve, arrowtail=curve, style=dashed]
d1->d1 [label = '0.65', dir=both, tailport = 'se', headport = 'ne', arrowhead=curve, arrowtail=curve, style=dashed]
d2->d2 [label = '0.72', dir=both, tailport = 'sw', headport = 'nw', arrowhead=curve, arrowtail=curve, style=dashed]
# Covariance
d1->d2 [label = '0.45', dir = both, arrowhead=vee, arrowtail=vee, splines=curved, tailport = 's', headport = 's']
}
")
And here are the plots:
First CFA plot with all edges straight
Second CFA plot with curved edges


