编写了一个简单的python程序,用于从节点通过管道分隔的文件中绘制图表。
文件中的示例数据格式: TRUE | CHECK_NRT_RAW_START
#!/usr/bin/python3
import pydotplus
import os
fileH = open("/home/corleone/pyGraph/nrt_chain/condition_step.txt")
G = pydotplus.Dot(graph_type="digraph")
node = pydotplus.Node('TRUE',style="filled", fillcolor="green")
G.add_node(node)
for line in fileH:
con=line.split('|')[0].strip().upper()
step=line.split('|')[1].strip().upper()
node=pydotplus.Node(step,style="filled",fillcolor="green")
G.add_node(node)
conditions = con.split('AND')
for c in conditions:
edge = pydotplus.Edge(c.strip(),step)
G.add_edge(edge)
G.write_pdf('NRT_CHAIN_Flow.pdf')
问题是,当节点数更多并且节点之间的连接性很复杂时,输出将非常非常复杂且无济于事。
因此,为了使图像更具可读性,我想增加水平节点之间的距离。
我该怎么做? 如果可能的话,还请提出一些其他建议,以使问题/ pdf更具可读性。
注意:由于尺寸问题,我无法附加复杂的图像,需要使其更具可读性。