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

问题描述 投票:0回答:1

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

图像是:

[当我在python中使用graphviz的子图时,我发现很难将子图的形状从矩形更改为椭圆或圆形。我怎样才能做到这一点?下面的代码来自graphviz import Graph g = ...

graphviz shapes subgraph
1个回答
0
投票
您无法设置簇的形状。您最能做的就是将样式设置为圆形以获得圆角
© www.soinside.com 2019 - 2024. All rights reserved.