How to change Graphviz subgraph rank?
Asked Answered
Q

2

18

I want subgraph clusterCG to have same rank as 3 (clusterCG schould not contain 3)

digraph G{
 rankdir = LR;
 node [shape = none]

 1->2->3->4[arrowhead=none]

 node [shape = ellipse]

 A->A2->A3;

 subgraph clusterCG{
  shape = rect;
  rank=same;
  A2;
  B;
  C;
  color=blue;
  label="C";
 }

 { rank=same; 1; A;}
 { rank=same; 3; CG;}
 { rank=same; 4; A3;}
}

enter image description here

CG is generated as independent node with rank 3.

I want the subgraph clusterCG to have rank 3.

Quickel answered 24/10, 2012 at 1:24 Comment(0)
Q
11

Maybe not the best solution, but it seems that zero size nodes is the only thing that works

digraph G{
 rankdir = LR;
 node [shape = none]

1->2->3->4[arrowhead=none]

node [shape = ellipse]
ACG[shape = none,label="",width=0, height=0];

CG->A2 [style=invis,constraint=false];

A->ACG[arrowhead=none];
ACG->A2->A3;

 subgraph clusterCG{
  shape = rect;
  rank=same;
  A2;
  B;
  C;
  color=blue;
  label="C";
 }

 { rank=same; 1; A;}
 { rank=same; 2; ACG;}
 { rank=same; 4; A3;}

}

enter image description here

Quickel answered 10/12, 2012 at 17:40 Comment(0)
V
18

use different rank algorithm with "newrank=true"

 digraph G {
 newrank=true
 rankdir = LR;
 node [shape = none]

 1->2->3->4[arrowhead=none]

 node [shape = ellipse]

 A->A2->A3;

 subgraph clusterCG{
  shape = rect;
  rank=same;

  A2;
  B;
  C;
  color=blue;
  label="C";
 }

 { rank=same; 1; A;}
 { rank=same; 3; A2}
 { rank=same; 4; A3;}
}
Valletta answered 7/6, 2017 at 6:35 Comment(0)
Q
11

Maybe not the best solution, but it seems that zero size nodes is the only thing that works

digraph G{
 rankdir = LR;
 node [shape = none]

1->2->3->4[arrowhead=none]

node [shape = ellipse]
ACG[shape = none,label="",width=0, height=0];

CG->A2 [style=invis,constraint=false];

A->ACG[arrowhead=none];
ACG->A2->A3;

 subgraph clusterCG{
  shape = rect;
  rank=same;
  A2;
  B;
  C;
  color=blue;
  label="C";
 }

 { rank=same; 1; A;}
 { rank=same; 2; ACG;}
 { rank=same; 4; A3;}

}

enter image description here

Quickel answered 10/12, 2012 at 17:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.