我在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"有没有办法让它变成一个静态布局?
发布于 2011-08-31 15:58:14
定义节点的order对布局有影响。
如果您想保留布局并只更改节点的颜色,那么您将需要保持节点的()外观的顺序,并且只更改它们的fillcolor属性。
例如:
digraph g {
node [shape = circle, width = 0.95, fixedsize = true, style = filled, fillcolor = palegreen];
3;
"4-5";
7;
"8-9";
10 [fillcolor = grey];
18;
19;
// new default fillcolor
node [fillcolor = grey];
11;
12 [fillcolor = palegreen];
"13-14";
}结果是

您可以使用node [fillcolor = grey]指令指定默认属性,如果需要,将覆盖特定节点上的默认值 (12 [fillcolor = palegreen])。
https://stackoverflow.com/questions/7250670
复制相似问题