r - Specify two different rankdir for node branching at end - Stack Overflow

How to get nodes a2 and a3 to fall vertically in line with a1 without having to specify node width and

How to get nodes a2 and a3 to fall vertically in line with a1 without having to specify node width and height?

library(DiagrammeR)
grViz("
 digraph G {
  
    graph [splines=ortho, nodesep=1, dpi=70]
    rankdir=LR
    
    node [shape=box, fontname=Helvetica];
    {rank=same;
        x1; x3;
        y1 [shape = point, width = 0, height = 0];
    }
    x2[fontsize=20,height=1.5,width=2];
    x4; x5;
    
    x1 [label = 'a0'];
    x2 [label = 'b0'];
    x3 [label = 'a1'];
    x4 [label = 'a2'];
    x5 [label = 'a3'];
    
    x1 -> y1 [arrowhead=none]
    y1 -> x2
    y1 -> x3
    x3 -> {x4, x5}
 
 }
")

Current output:

Desired output (only showing last 3 boxes):

How to get nodes a2 and a3 to fall vertically in line with a1 without having to specify node width and height?

library(DiagrammeR)
grViz("
 digraph G {
  
    graph [splines=ortho, nodesep=1, dpi=70]
    rankdir=LR
    
    node [shape=box, fontname=Helvetica];
    {rank=same;
        x1; x3;
        y1 [shape = point, width = 0, height = 0];
    }
    x2[fontsize=20,height=1.5,width=2];
    x4; x5;
    
    x1 [label = 'a0'];
    x2 [label = 'b0'];
    x3 [label = 'a1'];
    x4 [label = 'a2'];
    x5 [label = 'a3'];
    
    x1 -> y1 [arrowhead=none]
    y1 -> x2
    y1 -> x3
    x3 -> {x4, x5}
 
 }
")

Current output:

Desired output (only showing last 3 boxes):

Share Improve this question edited Jan 30 at 1:28 SRL asked Jan 29 at 19:19 SRLSRL 1872 silver badges10 bronze badges 2
  • regardless of how much text is contained within a2 and a3? - Nope, not realistically with dot – sroush Commented Jan 29 at 23:17
  • @sroush edited to remove that constraint – SRL Commented Jan 30 at 1:28
Add a comment  | 

1 Answer 1

Reset to default 1

Flipped back to default rankdir and associated changes.
All-in-all dot may not be the best tool for your needs. pikchr (https://pikchr./home/doc/trunk/homepage.md) might work better.

 digraph G {
  
    graph [ splines=ortho,  nodesep=1, dpi=70]
   // rankdir=LR
    
    node [shape=box, fontname=Helvetica];
   // {rank=same;
        x1; x3;
        y1 [shape = point, width = 0, height = 0 ]
   // }
    
    x1 [label = "a0"];
    x2 [label = "b0" fontsize=20,height=1.5,width=2]
    x3 [label = "a1"];
    // x2[fontsize=20,height=1.5,width=2];
    x4[label = "a2"];
    x5[label = "a3"];
 
    {rank=same x2 y1}
    {rank=same x4 x5 } 
    x1 -> y1 [arrowhead=none]
    y1 -> x2
    y1 -> x3
    x3 -> x4
    x3 -> x5
}

Giving:

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745281958a4620327.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信