I want a table of 2 columns with graphviz. Within the first columns I would like to have fixed positions for the nodes (x and Y). The other nodes can be freely positioned by graphviz within the assigned (other) column, i.e. the Y position does not matter. The positions within the first columns should not change, regardless of the connections to the nodes in the other columns
digraph G {
rankdir=LR;
node [shape=box];
subgraph cluster_0 {
label = "Spalte 1";
a [pos="0,2!"];
b [pos="0,1!"];
c [pos="0,0!"];
}
subgraph cluster_1 {
label = "Spalte 2";
d;
e;
f;
}
a-> e;
a -> f;
}
Currently the column slides up instead of the nodes within the column. Just change a-> to somethig to see it.
I want a table of 2 columns with graphviz. Within the first columns I would like to have fixed positions for the nodes (x and Y). The other nodes can be freely positioned by graphviz within the assigned (other) column, i.e. the Y position does not matter. The positions within the first columns should not change, regardless of the connections to the nodes in the other columns
digraph G {
rankdir=LR;
node [shape=box];
subgraph cluster_0 {
label = "Spalte 1";
a [pos="0,2!"];
b [pos="0,1!"];
c [pos="0,0!"];
}
subgraph cluster_1 {
label = "Spalte 2";
d;
e;
f;
}
a-> e;
a -> f;
}
Currently the column slides up instead of the nodes within the column. Just change a-> to somethig to see it.
Share Improve this question edited Nov 18, 2024 at 19:11 eshirvana 24.7k3 gold badges27 silver badges42 bronze badges asked Nov 18, 2024 at 19:10 ozzozz 1831 silver badge13 bronze badges1 Answer
Reset to default 0packmode (https://www.graphviz./docs/attr-types/packMode/) seems to accomplish your goal.
Note that nodes are in first-in-last-out order.
digraph G {
rankdir=LR;
packmode="array_ic2" // the two clusters must not be connected (no edges)
// packmode works best with recent (~2024 and later) releases of Graphviz
node [shape=box];
subgraph cluster_0 {
label = "Spalte 1";
a [pos="0,2!"]; // fyi, dot ignores all pos attributes
b [pos="0,1!"];
c [pos="0,0!"];
}
subgraph cluster_1 {
label = "Spalte 2";
d;
e;
f;
}
// packmode requires no edges between the clusters to be "packed"
// a-> e;
// a -> f;
}
Giving: