【发布时间】:2021-04-18 02:18:09
【问题描述】:
编辑:在我即将提交时找到了答案。这篇文章讨论了不可见的边缘:Graphviz top to bottom AND left to right
我目前正在使用 python 包“diagrams”为我的项目构建流程图。不幸的是,由于从左到右或从上到下的所有方向(据我所知,无法混合两者),它会导致一些难看的显示。
这是我图表代码的 sn-p:
from diagrams import Diagram, Cluster
from diagrams.generic.database import SQL
from diagrams.generic.place import Datacenter
from diagrams.generic.compute import Rack
from diagrams.generic.network import Subnet
from diagrams.aws.general import User
with Diagram('Sample', show=False, outformat='png', direction='LR'):
database_1 = SQL('Database 1')
database_2 = SQL('Database 2')
database_3 = SQL('Database 3')
server = Datacenter('Datacenter')
human = User('Human Reviewer')
with Cluster('Additional items to group separately', direction='TB'):
process = Subnet('Connection')
compute = Rack('Compute')
compute_other = Rack('Compute Other')
with Cluster('Files to group together'):
database_4 = SQL('Database 4')
database_5 = SQL('Database 5')
database_6 = SQL('Database 6')
[database_4, database_5, database_6] >> compute
database_1 >> server
database_2 >> server
database_3 >> server
server >> process >> compute >> compute_other >> human
但所需的图像应该是簇'Files to group together' 水平分布以使图表更紧凑的图像。有关所需的输出,请参见此图。
有没有办法让集群'Files to group together' 水平对齐,同时让图表的其余部分从左到右流动?我在想我只需要在集群中的项目之间创建不可见的边缘,但我似乎无法在 graphviz 中找到将边缘设置为不可见的选项(而且似乎没有独特的选项graphviz 中没有的图表)。
注意:我试过 Edge(color=None),但你仍然可以看到一个箭头,并且没有从 db4 到 db5 到 db6 的流,所以 Edge 只是试图强制对齐
有没有更好的包来构建这些图表?
谢谢!
【问题讨论】: