我有这个 Graphviz DOT 图:
digraph unit_test {
label="Unit test"
edge [fillcolor="#a6cee3" color="#1f78b4"]
node[shape="ellipse" style="filled" fillcolor="#1f77b4"]
start
end
node[shape="box" style="filled" fillcolor="#ff7f0e"]
process
subgraph cluster_process {
label = "Major logic"
process
}
start -> process
process -> end
}
以上呈现为:
我有第二张图:
digraph details {
label = "Process details"
edge [fillcolor="#a6cee3" color="#1f78b4"]
node[shape="ellipse" style="filled" fillcolor="#1f77b4"]
start
end
node[shape="box" style="filled" fillcolor="#ff7f0e"]
details
subgraph cluster_details {
label = "Details"
details
}
start -> details
details -> end
}
渲染到:
问题
当我将以上两个图表放入同一个名为 supporting.dot
的 DOT 文件中并运行 dot -Tpng -o supporting.png supporting.dot
命令时,终端打印出一些胡言乱语,输出图像文件不会包含两个图形,它只包含第一个。是否可以在单个 DOT 文件中使用多个图形?如果是这样,我错过了什么?
最佳答案
问题不清楚要完成什么,但也许以下是一个起点
digraph G{
subgraph unit_test {
label="Unit test"
edge [fillcolor="#a6cee3" color="#1f78b4"]
node[shape="ellipse" style="filled" fillcolor="#1f77b4"]
start
end
node[shape="box" style="filled" fillcolor="#ff7f0e"]
process
subgraph cluster_process {
label = "Major logic"
process
}
start -> process
process -> end
}
subgraph details {
label = "Process details"
edge [fillcolor="#a6cee3" color="#1f78b4"]
node[shape="ellipse" style="filled" fillcolor="#1f77b4"]
start1 [label="start"]
end1 [label="end"]
node[shape="box" style="filled" fillcolor="#ff7f0e"]
details
subgraph cluster_details {
label = "Details"
details
}
start1 -> details
details -> end1
}
}
注意第二个子图中的命名/标签。
关于graphviz - Graphviz DOT 文件中的多个图形,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63869676/