在 Graphviz 中将节点的标签方向更改为 90°

scd*_*scd 5 graphviz

有什么办法可以改变文本90\xc2\xba的方向吗?

\n\n

例子:

\n\n

初始图:

\n\n

初始图

\n\n

所需图表:

\n\n

在此输入图像描述

\n\n

我的代码:

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

Dan*_*any 1

无法在 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>>];
}
Run Code Online (Sandbox Code Playgroud)

结果:

2.如果需要旋转整个图形中的标签,可以尝试先绘制旋转的图形,然后旋转整个图像,例如使用旋转图形属性:

digraph {
    rotate=90
    a [
        label="One"
    ]
    b [
        label="Two"
    ]
    a -> b [label="label"];
}
Run Code Online (Sandbox Code Playgroud)

结果:

在此输入图像描述