【发布时间】:2020-07-05 13:54:32
【问题描述】:
当我在 python 中使用 graphviz 的子图时,我发现很难将子图的形状从矩形更改为 椭圆或圆形。我怎样才能做到这一点? 代码如下
from graphviz import Graph
g = Graph('G', filename='fdpclust.gv', engine='fdp')
with g.subgraph(name='clusterA',graph_attr ={'shape':'ellipse'}) as a:
a.node('a',fontname="SimSun",fontsize='29')
a.node('b')
with a.subgraph(name='clusterC',graph_attr ={'shape':'ellipse'}) as c:
c.attr(shape='ellipse')
c.node('C')
c.node('D')
with g.subgraph(name='clusterB',graph_attr ={'shape':'circle'}) as b:
b.node('d')
b.node('f')
g.view()
图片是:
【问题讨论】: