在Graphviz中更改节点的标签方向90º

时间:2019-03-05 18:17:27

标签: graphviz

有什么方法可以将文本的方向更改为90º?

示例:

初始图:

Initial graph

所需图形:

enter image description here

我的代码:

digraph G {
  layout="neato"
  edge[arrowhead=none]
  node[style=filled fillcolor="white", fixedsize=true]
  circunferencia[label="", pos="0.0, 0.0!", shape = "circle", width=2, color="grey", style=boldsi];
  1[label="1()", pos="0.30901699437494745,0.9510565162951535!", shape = "circle"];
  5[label="5()", pos="-0.8090169943749473,0.5877852522924732!", shape = "circle"];
  4[label="4()", pos="-0.8090169943749476,-0.587785252292473!", shape = "circle"];
  3[label="3()", pos="0.30901699437494723,-0.9510565162951536!", shape = "circle"];
  2[label="2()", pos="1.0,-2.4492935982947064e-16!", shape = "circle"];
  centro[label="", pos="0.0, 0.0!", shape = "point", fillcolor=black];
}

1 个答案:

答案 0 :(得分:0)

无法在graphviz中本地旋转标签。

您的选择可能是:

1。。将标签作为图像提供。在这种情况下,您可以根据需要在图形编辑器中旋转它们:

digraph {
    a [
        image="one.png"
        label=""
    ]
    b [
        image="two.png"
        label=""
    ]
    a -> b [label=<<TABLE border="0">
    <TR><TD><IMG SRC="rot.png"/></TD></TR>
    </TABLE>>];
}

结果:

2。。如果需要在整个图形中旋转标签,则可以尝试绘制最初旋转的图形,然后旋转整个图像,例如使用rotate图形属性:< / p>

digraph {
    rotate=90
    a [
        label="One"
    ]
    b [
        label="Two"
    ]
    a -> b [label="label"];
}

结果:

enter image description here