python - Graphviz-Python : Making node shape into double ellipse with Graphviz

标签 python graphviz

我正在使用 Graphviz 0.5.2在我的 python 脚本中,与此类似

from graphviz import Digraph
dot = Digraph()
dot.node('A', 'King Arthur', shape='ellipse')
dot.node('B', 'Sir Bedevere the Wise', shape='ellipse')
dot.node('L', 'Sir Lancelot the Brave', shape='ellipse')

dot.edges(['AB', 'AL'])
dot.edge('B', 'L', constraint='false')
dot.render('test-output/round-table.gv', view=True)

它呈现这个:

enter image description here

默认情况下,节点的形状是椭圆形/椭圆形,但我想将其设为双椭圆形,有双圆形但不是椭圆形。

我试过 peripheries = 2 但我不确定放置它的正确位置。

最佳答案

将外围应用于节点属性,例如

graph ethane {
node[ peripheries=5];
     C_0 -- H_0 [type=s];
     C_0 -- H_1 [type=s];
     C_0 -- H_2 [type=s];
     C_0 -- C_1 [type=s];
     C_1 -- H_3 [type=s];
     C_1 -- H_4 [type=s];
     C_1 -- H_5 [type=s];
 }

参见 chart

在 python 中,如果我理解示例的话

dot.node_attr['peripheries']='5' #whole graph
n.attr['peripheries']='5' #any single node n

https://github.com/pygraphviz/pygraphviz/blob/master/examples/star.py

关于python - Graphviz-Python : Making node shape into double ellipse with Graphviz,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41970749/

相关文章:

Python 查找时间在列表中不连续

python - np.where 返回一个空数组,其中包含 numpy 数组

python - 要求用户输入数字并输出总和以及输入数字的数量的程序

python - Django.core.exceptions.ImproperlyConfigured :

python - Graphviz:为具有彩虹效果的线条着色

windows - Graphviz:如何从 .dot 到图表?

python - 如何在 Python/flask 中打开和搜索大文本文件

ruby - 复杂的graphviz树结构

c++ - 如何在 boost 中正确使用捆绑属性?