Search code examples
visualizationgraphvizdot

How to get different ranksep for certain ranks


I want my bottom rank of nodes to have smaller ranksep than the rest of my graph. How do you do this? I can't seem to find the right syntax to set ranksep separately for different subgraphs.

This is not working - all ranks are separated the same (both the big ranksep and small ranksep are ignored):

graph G{
  {  ranksep=1.0; // big separation
     1 -- 2
     1 -- 3
  }
  {  ranksep=0.2;  // small separation
     2 -- 4
     2 -- 5
     3 -- 6
     3 -- 7
  }
}

Result:

ranksep


Solution

  • ranksep is an graph attribute (not subgraph), and cannot be used to vary the distance between ranks within the same graph in dot.