I'm using Graphviz tool in dot language using Linux. I want to draw three squares, one inside another. The below code is incorrect:
graph A
{ label="a";
subgraph cluster_A
{
b [shape=box,label="b"];
subgraph cluster_b
{
c[label="c",shape=box];
}
}
}
you have multiple possibilities to do that
box in clusters:
graph "graph A"
{
label="\G"
subgraph "cluster A"
{
subgraph "cluster B"
{
c[shape=box];
}
}
}
plaintext in clusters:
graph "graph A"
{
label="\G"
subgraph "cluster A"
{
subgraph "cluster B"
{
subgraph "cluster C"
{
d[shape=none];
}
}
}
}
both variants have the labels set to their names which is default for nodes but not for graphs (and all included subgraphs). as the graph label is inherited you can either set all labels manually or use the name palceholder as I did.
for HTML like lables
graph "graph A"
{
label="\G"
a [shape=none label=<<table><tr><td><table><tr><td><table><tr><td>node a</td></tr></table></td></tr></table></td></tr></table>>];
}
you have a lot more of freedom in formatting (margin, padding, border, ...)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With