Graphviz 不在边缘线后面的标签

Graphviz 不在边缘线后面的标签,graphviz,Graphviz,我以前使用graphviz处理更小的图,这次一种结构方程建模类型的图让我有些头疼。如果使用了spline=line,则图表顶部的标签似乎不跟随线条。这在图表的顶部更为突出 如何使标签与路径正确匹配 结果: p、 我们也欢迎其他改进建议。 Graphviz不提供沿边曲线的边标签。有人请求使用此功能()。你可以分享你的兴趣 你的消息来源有几个次优 G被宣布两次——合法但不必要 边b->X具有X属性而不是标签。没什么大不了的 可能性: 考虑其他布局引擎。circo和twopi很有趣 增

我以前使用graphviz处理更小的图,这次一种结构方程建模类型的图让我有些头疼。如果使用了
spline=line
,则图表顶部的标签似乎不跟随线条。这在图表的顶部更为突出

  • 如何使标签与路径正确匹配
结果:

p、 我们也欢迎其他改进建议。

  • Graphviz不提供沿边曲线的边标签。有人请求使用此功能()。你可以分享你的兴趣
  • 你的消息来源有几个次优
    • G被宣布两次——合法但不必要
    • 边b->X具有X属性而不是标签。没什么大不了的
可能性:

  • 考虑其他布局引擎。circo和twopi很有趣
  • 增加nodesep
  • try spline=true(这似乎很有帮助)
  • 将字体颜色与边缘颜色匹配
  • 考虑删除X和G的秩=相同(同样,这似乎真的很有帮助)
  • 对于a-f->X,尝试使用taillabel而不是label
这些变化大多是表面上的,只是为了让我更容易理解。
一个不确定的变化是改变了G和X的排名。你的电话

digraph plot {
    graph [ fontsize = 10, splines=line, nodesep = 0.8];
    splines=true
    
    subgraph controls {
        rank = same
        node [shape = box];
            a; b; c; d; e; f;
    }
    subgraph central {
        //rank = same
        G [shape = circle]
        X [shape = box];
    }
    
    node [shape = box ];
        H; I; J; K; L; M; O; P
        
    edge [ color = black ]
        a->X [taillabel = "0.3***"] 
        b->X [taillabel = "0.21***"] 
        c->X [taillabel = "0.08***"  labelangle=-70]  // tweak
        f->X [taillabel = "-0.08***" color=red] 
        d->X [taillabel = "0.06***"] 
        e->X [taillabel = "-0.09***" color=red] 

        X->G [label = "0.19***"]
        d->G [label = "0.06***"] 
        e->G [label = "-0.15***" color=red]
        a->G [label = "-0.32***" color=red]
        b->G [label = "0.15***"]
        c->G [label = "0.06***"]
        f->G [label = "-0.12***" color=red]
        G->G [label= 1 ]
    
        G->H [label = "0.85***"] 
        G->I [label = "0.89***"] 
        G->J [label = "0.76***"] 
        G->K [label = "0.85***"] 
        G->L [label = "0.74***"]
        G->M [label = "0.81***"] 
        G->O [label = "0.8***"]
        G->P [label = "0.76***"]
}
给予:

digraph plot {
    graph [ fontsize = 10, splines=line, nodesep = 0.8];
    splines=true
    
    subgraph controls {
        rank = same
        node [shape = box];
            a; b; c; d; e; f;
    }
    subgraph central {
        //rank = same
        G [shape = circle]
        X [shape = box];
    }
    
    node [shape = box ];
        H; I; J; K; L; M; O; P
        
    edge [ color = black ]
        a->X [taillabel = "0.3***"] 
        b->X [taillabel = "0.21***"] 
        c->X [taillabel = "0.08***"  labelangle=-70]  // tweak
        f->X [taillabel = "-0.08***" color=red] 
        d->X [taillabel = "0.06***"] 
        e->X [taillabel = "-0.09***" color=red] 

        X->G [label = "0.19***"]
        d->G [label = "0.06***"] 
        e->G [label = "-0.15***" color=red]
        a->G [label = "-0.32***" color=red]
        b->G [label = "0.15***"]
        c->G [label = "0.06***"]
        f->G [label = "-0.12***" color=red]
        G->G [label= 1 ]
    
        G->H [label = "0.85***"] 
        G->I [label = "0.89***"] 
        G->J [label = "0.76***"] 
        G->K [label = "0.85***"] 
        G->L [label = "0.74***"]
        G->M [label = "0.81***"] 
        G->O [label = "0.8***"]
        G->P [label = "0.76***"]
}