我正在使用 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)
它呈现这个:
默认情况下,节点的形状是椭圆形/椭圆形,但我想将其设为双椭圆形,有双圆形但不是椭圆形。
我试过 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/