如何在graphviz的边缘上放置边缘标签 [英] How to place edge labels ON edge in graphviz

查看:186
本文介绍了如何在graphviz的边缘上放置边缘标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Graphviz中,默认情况下,边缘标签位于边缘的右侧.我正在寻找一种将标签放置在边缘上方,以边缘为中心的方法. (由于我正在更改边缘的颜色,因此仍然可以读取).

By default in Graphviz, edge labels are placed just to the right of the edge. I'm looking for a way to place the labels OVER the edge, centred on the edge. (It'll still be readable because I'm changing the colour of the edge).

有什么想法吗?

推荐答案

如果这是headlabel或taillabel,则可以尝试将labeldistance设置为零以强制在边缘上绘制标签,但是据我了解,您指的是边缘标签(边缘中间的那个).文档非常清楚地指出,labeldistance仅影响headlabel和taillabel标签,但是您可以尝试运气.

If this was headlabel or taillabel, you could try setting labeldistance to zero to force the label to be drawn on the edge, but as I understand, you are referring to edge label (the one on the middle of the edge). Documentation quite clearly states that labeldistance only affects headlabel and taillabel labels, but you can try your luck.

您可能要尝试的另一件事是制作一个带有标签的透明中间节点.看起来像您想要的...但是,如果您严重依赖节点放置算法,则创建那些人工"节点可能是不可接受的.在这种情况下,我鼓励您加入graphviz开发人员并添加所需的功能;)说真的,这是非常令人满意的.

One other thing you might want to try is to make a transparent, intermediary node with a label on it. It could look like you want... But if you heavily rely on node placement algorithm, it could be unacceptable to create those 'artificial' nodes. In that case, I encourage you to join graphviz developers and add the feature you need ;) Seriously, it is very satisfying.

如果找到其他解决方案,请发布它.在不久的将来,我将面临类似的问题.

If you find another solution, please post it. I will be facing a similar problem in the near future.

这篇关于如何在graphviz的边缘上放置边缘标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆