0

When i use graphviz's subgraph in python, I found it's hard to change subgraph's shape from rectangle to ellipse or circle. How can i do this? the code is below

 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 image is:

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

albert
  • 8,285
  • 3
  • 19
  • 32

1 Answers1

0

You can't set the shape of clusters. The closest you can do is setting the style to rounded to get round corners

Jens
  • 2,327
  • 25
  • 34