Remove rectangle from Graphviz Dot cluster subgraph

mdashx picture mdashx · Sep 9, 2011 · Viewed 9.5k times · Source

Is there a way to tell Dot to use a cluster but not show the rectangle around the subgraph nodes?

Answer

marapet picture marapet · Sep 9, 2011

You can do this with style.

Example using style=invis:

digraph g{
 subgraph cluster0 {
  style=invis;
  1 -> 2;
 }
}

If you'd like to use this as a default for all subgraphs, use subgraph[style=invis] :

digraph g{
 subgraph[style=invis];

 subgraph cluster0 {
  1 -> 2;
 }
}

Edit: 9 years later...

The best solution is to use

peripheries=0

This will actually prevent generating the rectangle in svg output, whereas penwidth=0 still includes a polygon (with stroke-width="0", but it's still there).

I've added this since this is the most upvoted answer.