I have the following .dot
file.
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"]
}
Rendering with graphviz I get the following.
Is there any way I can force the edges to have square corners rather than rounded corners? The splines=ortho
attribute from the documentation seems to be designed for this in principle, but in practice I just get straight lines when I add graph [splines=ortho]
to my digraph.
Any way I can get square corners on the edges with graphviz? Something like the following:
------ Multiple genes? -----
| |
| N Y |
| |
v V
siLocus ciLocus
Maybe you can start out by using splines=line
digraph
{
splines=line
...
which will give you this graph:
From there you might need to manually position the nodes, or insert hidden nodes and edges like
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"]
}
which produces
Alternatively, you can insert spaces in the top labels to make lower nodes line up better:
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"]
}
which produces
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With