Seaborn clustermap square cells

21 Views Asked by At

I am trying to create a clustermap with the cells appearing as squares like in the image below.

enter image description here

I was hoping it would be simple as in a regular heatmap, where you can specify square=True, but I understand this is not the case. Searching online gave complex solutions to all sorts of quite old questions on fixed cell sizes, however, I am not looking for fixed size, but just square cells inside my clustermap. Is there a simple solution to this?

`

def CreateClustermap(AllData, Title):
    clustered_heatmap = sns.clustermap(AllData, method='average', cmap="RdBu_r", dendrogram_ratio=0.1)
    clustered_heatmap.tick_params(axis='both', labelsize=8)
    cbar = clustered_heatmap.ax_heatmap.collections[0].colorbar
    cbar.ax.set_position([0.95, 0.3, 0.02, 0.5])
    clustered_heatmap.fig.suptitle(Title, fontsize=10, y=0.05)
    return clustered_heatmap

`

0

There are 0 best solutions below