BRS
BRS

Reputation: 81

Graphviz: Stacking fields vertically within a subraph

I am trying to stack a group of fields vertically (there are 8 specific fields, so I would preferably have 4x4) within Graphviz. I have a subgraph cluster containing 8 fields, which by default are lined up side by side horizontally, making connections extremely messy. I feel it would be much more clear if the subfields were stacked vertically.

Upvotes: 8

Views: 1139

Answers (1)

marapet
marapet

Reputation: 56466

A common technique to layout nodes is to use invisible edges.

In the following example, the nodes n1-n8 are layed out vertically within a cluster, but no edges are displayed.

digraph g{

  subgraph cluster0 {
    edge[style=invis];
    n1->n2->n3->n4->n5->n6->n7->n8;
  }

  // some visible edges from nodes outside of the cluster to nodes within the cluster
  a -> b;
  a -> {n2;n7;n8};
  b -> {n4;n6;n7;};
}

Upvotes: 7

Related Questions