有没有办法让graphviz左对齐或右对齐同一级别的节点,而不是居中?
digraph h {
rankdir=LR;
node [shape=record,height=.08,fontsize=11];
elk[label="elk|I am an American Elk"];
buffalo[label="buffalo|Just a buffalo|everywhere I go|people know the part I'm playing"];
cow[label="cow|moo"];
moose[label="Bullwinkle J. Moose|Hey Rocky, watch me pull a rabbit out of my hat!"];
zoo [label="zoo|<p0>|<p1>|<p2>|<p3>"];
zoo:p0 -> elk;
zoo:p1 -> cow;
zoo:p2 -> moose;
zoo:p3 -> buffalo;
}
答案 0 :(得分:26)
很高兴看到有人使用如此重要的数据。
这是一种无法满足的方式:
digraph h {
rankdir=LR;
node [shape=record,height=.08,fontsize=11];
zoo [label="zoo|<p0>|<p1>|<p2>|<p3>"];
node [width=3.5];
elk[label="elk\l|I am an American Elk\l",];
buffalo[label="buffalo\l|Just a buffalo\l|everywhere I go\l|people know the part I'm playing\l"];
cow[label="cow\l|moo\l"];
moose[label="Bullwinkle J. Moose\l|Hey Rocky, watch me pull a rabbit out of my hat!\l"];
zoo:p0->elk; zoo:p1 -> cow; zoo:p2 -> moose; zoo:p3 -> buffalo;
}
为该等级中的每个框赋予相同(经验确定的)宽度,然后使用奇怪的\l
“左对齐的换行符”左对齐文本。