# Adjusting width of clusters

**URL:** <https://forum.graphviz.org/t/adjusting-width-of-clusters/2396>\
**Category:** Help\
**Created:** [August 15, 2024, 2:30pm UTC](https://forum.graphviz.org/t/adjusting-width-of-clusters/2396 "2024-08-15T14:30:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![red11](https://avatars.discourse-cdn.com/v4/letter/r/7bcc69/32.png) [@red11](https://forum.graphviz.org/u/red11)\
**Post date:** [August 15, 2024, 2:30pm UTC](https://forum.graphviz.org/t/adjusting-width-of-clusters/2396/1 "2024-08-15T14:30:26Z")

</div>

How can I adjust the width of Cluster\_2 to match the width of cluster\_1

digraph {  
rankdir=LR

subgraph “cluster\_MT”{

```
    subgraph "cluster_B1" {
      subgraph clusterI2{
        peripheries=0 // no surrounding box
        margin=0 // reduce vertical space
        "B1_invis"[shape=point style=invis width=0.01] // pin ignored by dot pin=true]
      }
      label = "Cluster_2"
    } 

    subgraph "cluster_A1" {
      "A1_invis"[shape=point style=invis] // pin ignored by dot pin=true]
        
      "A1"[label="Node 1", shape=rectangle]
      label = "Cluster_1"

      subgraph "cluster_A2"{
        A2[label="Node 2" shape=rectangle]  
        label = "Subcluster_1"
      }
    }

label = "Big Box"

```

}

}

---

<div class="post-metadata">

**Author:** ![steveroush](https://avatars.discourse-cdn.com/v4/letter/s/a9adbd/32.png) [@steveroush](https://forum.graphviz.org/u/steveroush)\
**Post date:** [August 15, 2024, 9:10pm UTC](https://forum.graphviz.org/t/adjusting-width-of-clusters/2396/2 "2024-08-15T21:10:27Z")

</div>

Short answer: no “simple” way to do this (e.g. setting **height** and/or **width** on clusters is ignored)

However, it can be done.  
For a one-time graph, you can produce an output file in **xdot** format ([DOT | Graphviz](https://www.graphviz.org/docs/outputs/canon/)), and hand-edit the **bb** ([bb | Graphviz](https://www.graphviz.org/docs/attrs/bb/)) or of the clusters that need to grow or the **width** of the node that needs to grow. Then feed that edited file into **neato -n …** ([FAQ | Graphviz](https://www.graphviz.org/faq/#FaqDotWithNodeCoords))  
Surprisingly easy since you are editing a text file. See below.

If you want something that can be programmatically “fixed”, a **python** , **gvpr** ([https://www.graphviz.org/pdf/gvpr.1.pdf](https://www.graphviz.org/pdf/gvpr.1.pdf)), or … program can find the **bb** entry of the clusters (after running `dot myFile.gv > myFile.dot`), calculate the widest **width** , and then apply that **width** to the other clusters or nodes as appropriate. That is how I _manually_ came to modify your file:

```auto
digraph {
  rankdir=LR

  subgraph “cluster_MT”{

    subgraph "cluster_B1" {
      subgraph clusterI2{
        peripheries=0 // no surrounding box
        margin=0 // reduce vertical space
        // width in inches, based on bb in points of other cluster
        "B1_invis" [shape=none Xstyle=invis label="" fixedsize=true width=1.525 height=.02]  
      }
      label = "Cluster_2"
    }

    subgraph "cluster_A1" {
      "A1_invis"[shape=point style=invis]
      "A1" [label="Node 1", shape=rectangle]
      label = "Cluster_1"

      subgraph "cluster_A2"{
        A2 [label="Node 2" shape=rectangle]
        label = "Subcluster_1"
      }
    }

    label = "Big Box"
  }
}
digraph {
  rankdir=LR

  subgraph “cluster_MT”{

    subgraph "cluster_B1" {
      subgraph clusterI2{
        peripheries=0 // no surrounding box
        margin=0 // reduce vertical space
        // width in inches, bb in points
        "B1_invis" [shape=none Xstyle=invis label="" fixedsize=true width=1.525 height=.02]  
      }
      label = "Cluster_2"
    }

    subgraph "cluster_A1" {
      "A1_invis"[shape=point style=invis]
      "A1" [label="Node 1", shape=rectangle]
      label = "Cluster_1"

      subgraph "cluster_A2"{
        A2 [label="Node 2" shape=rectangle]
        label = "Subcluster_1"
      }
    }
    label = "Big Box"
  }
}

```

Giving:  
 ![sameWidthClusters1](https://global.discourse-cdn.com/graphviz/original/2X/0/043814a1eab5b9fe1a51c819848575a424dfe27e.png)
