graphviz: force nodes to top in rankdir=LR

断了今生、忘了曾经 提交于 2019-12-12 04:25:45

问题


I want to have the 'start middle end' label appear at the top of my graph

But it seems to default to the bottom no matter where I put the code. Is it possible?

digraph G {
  rankdir=LR;

{node [shape=plaintext, fontsize=16];
"Start"->"Middle"->"End"[style=invis];
}

node [shape=box];
{ rank=same
"Start";a;
}
{ rank=same
"Middle";b;d;
}
{ rank=same
"End";c;e;
}

"a"->"b"->"c";
"d"->"e";

}

回答1:


This works for me.

digraph G {
  rankdir=LR;
  {
    node [shape=box];
    blank [style=invisible]
    blank -> d [style=invisible dir=none]
    "a"->"b"->"c";
    "d"->"e";
  }
  {
    node [shape=plaintext, fontsize=16];
    "Start"->"Middle"->"End"[style=invisible dir=none];
  }
}



来源:https://stackoverflow.com/questions/38583805/graphviz-force-nodes-to-top-in-rankdir-lr

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!