Graphviz 中相同的节点,不同的颜色
我在 Graphviz 中有一个简单的有向图,有两种节点和边。每种都有自己的颜色。我的问题是,我想保留图表的绘制方式,但只需更改颜色。但是,当我交换两个节点定义中的节点名称时,图形会更改其布局。
node [shape = circle, width = 0.95, fixedsize = true, style = filled, fillcolor = palegreen] 3 "4-5" 7 "8-9" 10 18 19
node [shape = circle, width = 0.95, fixedsize = true, style = filled, fillcolor = grey] 11 12 "13-14"
有没有办法强制它采用静态布局?
I have a simple directed graph in Graphviz with two kinds of nodes and edges. Each kind has it's own color. My problem is, that I would like to keep how the graph is drawn, but just change the colors. However, when I swap the node names within the two node definitions, the graph changes its layout.
node [shape = circle, width = 0.95, fixedsize = true, style = filled, fillcolor = palegreen] 3 "4-5" 7 "8-9" 10 18 19
node [shape = circle, width = 0.95, fixedsize = true, style = filled, fillcolor = grey] 11 12 "13-14"
Is there a way to force it to one static layout?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
定义节点的顺序确实会对布局产生影响。
如果您想保留布局并仅更改节点的颜色,那么您需要保持节点(第一个)外观的顺序,并且仅更改其
填充颜色代码>属性。
例如:
生成
您可以使用
节点指定默认属性 [fillcolor = grey]
指令,并在需要时覆盖特定节点上的默认值 (12 [fillcolor = fadegreen]
)。The order in which the nodes are defined does have an impact on the layout.
If you want to keep the layout and change only the colors of the nodes, then you'll need to keep the order of (first) appearance of the nodes and only change their
fillcolor
attribute.For example:
Resulting in
You can specify the default attributes using the
node [fillcolor = grey]
instruction, and override the default values on a specific node if needed (12 [fillcolor = palegreen]
).