[英]Graphviz - Python : Making node shape into double ellipse with Graphviz
我在我的python腳本中使用Graphviz 0.5.2 ,與此類似
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];
}
見圖表
如果我理解示例中的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
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.