graphviz: force nodes to top in rankdir=LR

2019-09-16 18:12发布

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";

}

标签: graphviz dot
1条回答
来,给爷笑一个
2楼-- · 2019-09-16 18:44

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];
  }
}

enter image description here

查看更多
登录 后发表回答