如何将graphviz.subgrah的形状更改为椭圆或圆形?

时间:2020-03-25 01:18:50

标签: graphviz shapes subgraph

当我在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()

图片为:

the shape of subgrap is rectangle, but i want it changes to  ellipse

1 个答案:

答案 0 :(得分:0)

您无法设置簇的形状。您最能做的就是将样式设置为圆角以获得圆角