使用graphviz在边上强制方形角
我有以下使用graphviz在边上强制方形角,graphviz,dot,Graphviz,Dot,我有以下.dot文件 digraph { node [color=Limegreen,fontcolor=Limegreen,shape=oval] ilocus [label="iLocus"] gilocus [label="giLocus"] pilocus [label="piLocus"] nilocus [label="niLocus"] silocus [label="siLocus"] cilocus [label="ciL
.dot
文件
digraph
{
node [color=Limegreen,fontcolor=Limegreen,shape=oval]
ilocus [label="iLocus"]
gilocus [label="giLocus"]
pilocus [label="piLocus"]
nilocus [label="niLocus"]
silocus [label="siLocus"]
cilocus [label="ciLocus"]
filocus [label="fiLocus"]
iilocus [label="iiLocus"]
node [color=Blue,fontcolor=Blue,shape=diamond]
containgene [label="Contains gene(s)?"]
proteincoding [label="Protein coding?"]
multiplegenes [label="Multiple genes?"]
geneflank [label="Flanked by genes\non both sides?"]
ilocus -> containgene
containgene:e -> geneflank [xlabel="No"]
geneflank:e -> filocus [xlabel="No"]
geneflank:w -> iilocus [xlabel="Yes"]
containgene:w -> gilocus [xlabel="Yes"]
gilocus -> proteincoding
proteincoding:e -> nilocus [xlabel="No"]
proteincoding:w -> pilocus [xlabel="Yes"]
pilocus -> multiplegenes
multiplegenes:e -> silocus [xlabel="No"]
multiplegenes:w -> cilocus [xlabel="Yes"]
}
使用graphviz渲染我得到以下结果
有什么办法可以强制边缘具有方形角而不是圆角?文档中的spline=ortho
属性在原则上似乎就是为此而设计的,但在实践中,当我向有向图中添加graph[spline=ortho]
时,我只得到了直线
我能用graphviz在边上画出直角吗?如下所示:
------ Multiple genes? -----
| |
| N Y |
| |
v V
siLocus ciLocus
您可以简单地使用
spline=false
()。也许您可以先使用spline=line
digraph
{
splines=line
...
这将为您提供以下图表:
从那里,您可能需要手动定位节点,或插入隐藏的节点和边,如
digraph
{
splines=line
node [color=Limegreen,fontcolor=Limegreen,shape=oval]
ilocus [label="iLocus"]
gilocus [label="giLocus"]
pilocus [label="piLocus"]
nilocus [label="niLocus"]
silocus [label="siLocus"]
cilocus [label="ciLocus"]
filocus [label="fiLocus"]
iilocus [label="iiLocus"]
node [color=Blue,fontcolor=Blue,shape=diamond]
containgene [label="Contains gene(s)?"]
proteincoding [label="Protein coding?"]
multiplegenes [label="Multiple genes?"]
geneflank [label="Flanked by genes\non both sides?"]
spacer1 [label="xxxx",style=invis]
{rank=same gilocus spacer1 geneflank}
gilocus -> spacer1 -> geneflank [style=invis]
ilocus -> containgene
containgene:e -> geneflank [xlabel="No"]
geneflank:e -> filocus [xlabel="No"]
geneflank:w -> iilocus [xlabel="Yes"]
containgene:w -> gilocus [xlabel="Yes"]
gilocus -> proteincoding
proteincoding:e -> nilocus [xlabel="No"]
proteincoding:w -> pilocus [xlabel="Yes"]
pilocus -> multiplegenes
multiplegenes:e -> silocus [xlabel="No"]
multiplegenes:w -> cilocus [xlabel="Yes"]
}
产生
或者,可以在顶部标签中插入空格,以使较低的节点更好地对齐:
digraph
{
splines=line
node [color=Limegreen,fontcolor=Limegreen,shape=oval]
ilocus [label="iLocus"]
gilocus [label="giLocus"]
pilocus [label="piLocus"]
nilocus [label="niLocus"]
silocus [label="siLocus"]
cilocus [label="ciLocus"]
filocus [label="fiLocus"]
iilocus [label="iiLocus"]
node [color=Blue,fontcolor=Blue,shape=diamond]
containgene [label=" Contains gene(s)? "]
proteincoding [label="Protein coding?"]
multiplegenes [label="Multiple genes?"]
geneflank [label="Flanked by genes\non both sides?"]
ilocus -> containgene
containgene:e -> geneflank [xlabel="No"]
geneflank:e -> filocus [xlabel="No"]
geneflank:w -> iilocus [xlabel="Yes"]
containgene:w -> gilocus [xlabel="Yes"]
gilocus -> proteincoding
proteincoding:e -> nilocus [xlabel="No"]
proteincoding:w -> pilocus [xlabel="Yes"]
pilocus -> multiplegenes
multiplegenes:e -> silocus [xlabel="No"]
multiplegenes:w -> cilocus [xlabel="Yes"]
}
产生
也许我的解释不清楚。我已经更新了,以准确地说明我所说的“方角”是什么意思。啊,对不起,我误解了。不幸的是,ortho很少做人们希望它做的事情……肯定是有帮助的,但令人沮丧的是,我无法获得90°的角度,例如,“包含基因”和“两侧都有基因”之间的“无”边。