Asim
Asim

Reputation: 1480

Graphviz graph to horizontal

I have seen answers at stack overflow that suggest to use:-

rankdir="LR

but they didn't work on this script of mine.

from graphviz import Digraph


dot = Digraph()
dot.node('A', '(3904,1) (Input)')
dot.node('B', '(3904,64) LSTM layer 1')
dot.node('C', '(3904,128) LSTM layer 2')

dot.edges(['AB', 'BC'])

dot.render("a.gv", view=True)

If I add this line:-

dot=Digraph(rankdir="LR)

it throws error that there is no attribute of digraph named "rankdir".

I want to convert my vertical graph to horizontal graph, any help will be much appreciated!! Thanks.

Upvotes: 7

Views: 3136

Answers (1)

Adam.Er8
Adam.Er8

Reputation: 13393

try:

dot = Digraph(graph_attr={'rankdir':'LR'})

Upvotes: 9

Related Questions