Graphviz 中的节点分层
我正在使用 Graphviz (用 neato 编译)创建一个图表。该图包含许多重叠的节点,这非常好。然而,有一组大节点我更喜欢始终位于其他小节点之上 - 尽管我更喜欢首先在图中定义大节点(这使得它们被绘制在最底部)。
有什么办法可以强制我这样做吗?
编辑:
这是一个小例子,只是为了澄清我的意思:
graph G {
node [style=filled,fillcolor=black];
BigNode [fillcolor=skyblue,shape=Msquare];
node [style=filled,fillcolor=red,shape=circle];
edge [style=invis]
1 -- BigNode[len=0.5];
2 -- BigNode[len=1];
}
我希望在节点 1
上绘制 BigNode
。
I'm creating a graph using Graphviz (compiled with neato). This graph contains many overlapping nodes which is perfectly fine. However, there is a group of large nodes which I prefer to always be on top of other small nodes - even-though I prefer to define the large nodes first in the graph (which makes them get painted at the very bottom).
Any way I can force this?
Edit:
Here's a small example, just to clarify what I mean:
graph G {
node [style=filled,fillcolor=black];
BigNode [fillcolor=skyblue,shape=Msquare];
node [style=filled,fillcolor=red,shape=circle];
edge [style=invis]
1 -- BigNode[len=0.5];
2 -- BigNode[len=1];
}
I'd like for BigNode
to be painted over node 1
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我确实找到了一种(某种)解决方案......
我发现,如果您仅将节点定义推迟到最后,即使您之前为该节点定义了边,它也会被绘制在最顶部。
我意识到这与我之前定义的内容相矛盾,但这是这种情况下唯一可能的解决方案,也是我最终不得不使用的解决方案。
在我的简短示例中,您可以这样做:
在生成的图中,
BigNode
绘制在节点1
上I did find one (sort of) solution...
I found that if you postpone only the node definition to the end, even if you defined edges for this node earlier, it will be painted top-most.
I realize this contradicts what I defined earlier, but this was the only possible solution in this case and it was the one I eventually had to use.
In my short example, you would do this:
In the resulting graph,
BigNode
is painted over node1
我认为这是不可能的。官方 neato 指南 在第 6 页到第 9 页上讨论了节点分层。它看起来像您能做的最多就是调整边的长度并固定节点:您实际上无法控制节点如何彼此分层。
I don't think it's possible. The official neato guide talks about node layering on pages 6 through 9. It looks like the most you can do is adjust the length of edges and pin down nodes: you can't actually control how nodes layer over each other.