graph-tool graphviz_draw:如何设置顶点高度和宽度

时间:2017-06-26 14:57:46

标签: python graphviz graph-tool

我想为顶点设置不同的高度和宽度。 使用graph_draw很容易:

read -p 'please enter the ssh server name: ' ssh_name
ssh ${ssh_name} remote_name="$ssh_name" 'bash' <<'EOF'
echo ${remote_name}
exit
EOF

但是graphviz_draw不存在vertex_aspect,并且设置高度和宽度无效。它只绘制圆形而不是椭圆形。

graph_draw(DG, ...
        vertex_aspect=1.6,
        ...
        )

非常感谢您的帮助

2 个答案:

答案 0 :(得分:1)

您需要将形状设置为&#34;椭圆形&#34; (默认为&#34;圈&#34;):

graphviz_draw(g, vprops={"height": 2, "width": 5, "shape": "oval"})

答案 1 :(得分:0)

您可以按如下方式设置节点高度和宽度:

digraph {
node [height=2.0]
node [width=3.0]
A->B
node [height=1.0]
node [width=0.5]
c->d
}

enter image description here 根据您的意愿改变宽度和高度时的不同宽高比,从上到下进行评估。

现在我意识到这是直接dot语法,但也许你可以做同样的效果?换句话说,考虑到特定的宽高比,例如1.5,设置width = height * 1.5,然后使用上面提到的语法。