使用Graphviz绘制表格式节点

时间:2017-04-09 22:55:43

标签: python graphviz

在graphviz - python中是否有一种方法可以绘制一列矩形节点,如下所示: enter image description here

我希望每个矩形都作为节点,因为这些节点是从前面的代码生成的,我已经绘制了一个节点树。

enter image description here

我已使用此命令

创建了我的节点
 tree.node(Taskstr+str(ID))

1 个答案:

答案 0 :(得分:0)

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