R 当主图从左到右时,如何使子图从上到下?

R 当主图从左到右时,如何使子图从上到下?,r,graphviz,diagrammer,R,Graphviz,Diagrammer,我有一张LR方向的图 digraph { rankdir=LR; node [shape=box] x1;x2;x3;y1;y2;y3;y4;y5;y6;y7;y8; node [shape=oval] ind60;dem60;dem65; {x1,x2,x3} -> ind60 dem65->{y5,y6,y7,y8} subgraph cluster_0{ rankdir=TB {y1,y2,y3,y4} -> dem60[

我有一张LR方向的图

digraph {
  rankdir=LR;
  node [shape=box]
  x1;x2;x3;y1;y2;y3;y4;y5;y6;y7;y8;
  node [shape=oval]
  ind60;dem60;dem65;
  {x1,x2,x3} -> ind60 
  dem65->{y5,y6,y7,y8} 

  subgraph cluster_0{
  rankdir=TB 

  {y1,y2,y3,y4} -> dem60[constraint=false]

  }
  ind60->dem60 ind60->dem65 dem60->dem65
}
结果如下:

我想要TB方向的子图。我怎样才能做到这一点


根据文档,rankdir仅适用于图,不适用于子图

您可以通过以不可见的边和节点的形式添加一些脚手架来解决此问题

digraph {
  rankdir=LR;
  node [shape=box]
  x1;x2;x3;y1;y2;y3;y4;y5;y6;y7;y8;
  node [shape=oval]
  ind60;dem60;dem65;
  {x1,x2,x3} -> ind60 
  dem65->{y5,y6,y7,y8} 

  subgraph cluster_0{

      y2a[shape=point color=none]
      y1->y2->y2a->y3->y4[color=none weight=1000]
      {y1 y2}->dem60
      {rank=same y2a->dem60[color=none]}
      {y3 y4}->dem60

  }
  {rank=same ya[shape=point color=none] x1 x2 x3}
  {rank=same yb[shape=point color=none] y5 y6 y7 y8}
  ya->y1[color=none] y4->yb[color=none]
  ind60->dem60 ind60->dem65 dem60->dem65
}

我确定我在这里很密集,但是你的子图看起来是自上而下的。b=自上而下,你的簇0子图的顶部是y1,底部是y4。这是从上到下的方向。你到底想要什么?我想要子图看起来像图像“子图”。谢谢