Подтвердить что ты не робот

Форсировать квадратные углы по краям с помощью графика

У меня есть следующий .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 я получаю следующее.

Graphviz take 1

Есть ли способ заставить края иметь квадратные углы, а не закругленные углы? Атрибут splines=ortho из документации, по-видимому, предназначен для этого в принципе, но на практике я просто получаю прямые строки, когда добавляю graph [splines=ortho] к моему орграфу.

Graphviz take 2

В любом случае, я могу получить квадратные углы по краям с помощью graphviz? Что-то вроде следующего:

  ------ Multiple genes? -----
  |                          |
  | N                      Y |
  |                          |
  v                          V
siLocus                   ciLocus
4b9b3361

Ответ 1

Возможно, вы можете начать с помощью splines=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"]
}

который производит

введите описание изображения здесь

Ответ 2

Вы можете просто использовать ссылку splines=false (для GraphvizFiddle).