graphviz:边缘的颜色方向
嗨
我可以让 graphviz 以识别方向的方式对边缘进行着色吗?例如,靠近源节点的边部分可能是蓝色的,然后当它靠近目标节点时逐渐变为红色。或者有其他绘图工具(如 graphviz)可以做到这一点吗?
任何在这方面的帮助将不胜感激。
Hi
Can I get graphviz to color the edges in a way that identifies the direction? For example, the part of the edge near its source node might be blue and then it gradually shades away to red as it nears the target node. Or are there any other graphing tools (like graphviz) that can do this?
Any help in this regard would be much appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好吧,我对您当前的点文件一无所知,所以我必须做出一些假设。首先处理简单的情况,区分边的方向是箭头(指向)和箭头尾(指向)的工作。仅当您的图形类型是有向图形(您在点文件顶部设置)时,您的图形才会呈现这些图形,例如,
如果您已经装箱有向图,但由于某种原因您想要一个附加指示器来显示边缘方向,那么我能想到的唯一相关边缘属性是 headlabel 和 taillabel 属性,允许您指定标签放置在边缘的哪一端。上面的小点文件将呈现此图:
Well, i don't know anything about your current dot file, so i'll have to make a couple of assumptions. To deal with the easy case first, distinguishing the the direction of an edge is the job of the arrowhead (points to) and arrowtail (points from). Your graph is only going to render those if your graph type is a directed graph, which you set at the top of your dot file, e.g.,
If you've already crated a directed graph but for some reason you want an additional indicator to show edge direction, then the only relevant edge attributes i can think of are the headlabel and taillabel attributes, which allows you to specify which end of an edge a label is placed. The small dot file above will render this graph:
自 2012 年和 2.30.0 起,Graphviz 支持多种边缘颜色:
color="blue;0.5:red"
应该使一半更接近源蓝色,一半更接近目标红色。 更准确地说:Since 2012 and 2.30.0, Graphviz supports multiple colors for edges:
color="blue;0.5:red"
should make the half closer to the source blue and the half closer to the target red. More precisely: