Neli
Neli

Reputation: 741

graph-tool graphviz_draw: how to set vertex height and width

I'd like to set different heights and widths for the vertices. It's easy with graph_draw:

graph_draw(DG, ...
        vertex_aspect=1.6,
        ...
        )

But vertex_aspect doesn't exist for graphviz_draw and setting height and width has no effect. It only draws circles not ovals.

graphviz_draw(DG, ...
        vprops={"height": 2, "width": 5},
        ...
        )

Thanks a lot for help

Upvotes: 1

Views: 771

Answers (2)

TomServo
TomServo

Reputation: 7409

You can set the node height and width as follows:

digraph {
node [height=2.0]
node [width=3.0]
A->B
node [height=1.0]
node [width=0.5]
c->d
}

enter image description here Different aspect ratios as you change the width and heights according to your wishes, evaluated from top to bottom.

Now I realize this is straight dot syntax, but perhaps you can do the same effect? In other words, with a particular aspect ratio in mind, like 1.5 for example, set width = height * 1.5 and then use the syntax you mentioned above.

Upvotes: 0

Tiago Peixoto
Tiago Peixoto

Reputation: 5261

You need to set the shape to "oval" (the default is "circle"):

graphviz_draw(g, vprops={"height": 2, "width": 5, "shape": "oval"})

Upvotes: 1

Related Questions