Dynamic Dendrogram Cutting

In figure 1, gaps (white space) are introduced in the heat map between clusters that are created by cutting the dendrogram. When there are lots of singleton clusters, the width of the heat map can become too large. One way to solve this issue is by "squishing" singleton clusters together as shown in figure 2.

Figure 1.

Figure 2.