Karam Abo Ghalieh
Karam Abo Ghalieh

Reputation: 428

Drawing table-like nodes uing Graphviz

Is there a way in graphviz - python to draw a column of rectangular nodes, like this: enter image description here

I want each rectangle as node since these nodes are generated from a previous code where I already drew a tree of nodes.

enter image description here

I have created my nodes using this command

 tree.node(Taskstr+str(ID))

Upvotes: 1

Views: 2430

Answers (1)

Craig
Craig

Reputation: 4855

The Python code will depend on which library you are using to call Graphviz, but whichever one you use, you want to set the node shape=record and the label to contain the items of the record between curly braces ('{}') with pipe ('|') characters between each row.

Here's what the dot file will look like for your first example:

digraph structs {
    n1 [shape=record label="{  |  |  | Task#2 | Task#1 }"]
}

which renders as:

record node example

Upvotes: 1

Related Questions