Я пытаюсь нарисовать модель lavaan
, используя Graphviz
, и в целом доволен тем, как она выглядит (1-й график), но хочу, чтобы край между двумя измерениями был изогнутым, а все остальные - прямыми .
Можно ли заставить границу между измерениями (от d1
до d2
) искривиться, указав graph [layout = neato, overlap = FALSE, outputorder = edgesfirst, splines = curved]
, как вы можете видеть на втором графике, но при этом все они будут изогнутыми.
Может ли кто-нибудь подсказать мне, как получить желаемый результат?
Вот код для воспроизведения первого графика:
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']
}
")
А вот графики:
Первый график CFA со всеми прямыми краями
Второй график CFA с изогнутыми краями