Search code examples
matlabheatmapdendrogram

MATLAB Heatmap dendrogram not showing column names when there are many names


I have a list of a proteins and values for each protein based on three different experimental conditions (alpha, beta and gamma). The array containing the values is called 'heatmap_data'. The name of the proteins is in the array called: 'text'

I generated a heatmap:

rows = ['ALPHA' ;'BETA '; 'GAMMA']
rowscell = cellstr(rows)
dm=DataMatrix(heatmap_data,rowscell,text);
cg = clustergram(dm,'Standardize','none');
cgAxes =plot(cg);
set(cgAxes, 'Clim', [-1,1])

When the list of proteins is short, I got the expected heatmap, showing labels for x axis enter image description here

However, when the list extens to few hundreds, the names disappear. enter image description here

I can understand that the labels might not fit in the short space, but if they were written I could reduce font size, or expand the dendrogram, etc

My question: is there a way to force MATLAB to show the column names even if they overlap, or a function I can save the names in the same order the dendrogram ordered so I can identify which proteins are in each cluster?

Thanks


Solution

  • Ok, I found this: https://www.mathworks.com/help/bioinfo/ref/clustergram.html

    RowLabelsValue Vector of numbers or cell array of character vectors to label the rows in the dendrogram and heat map. Default is a vector of values 1 through M, where M is the number of rows in Data. Note:
    If the number of row labels is 200 or more, the labels do not appear in the clustergram plot unless you zoom in on the plot.

    Now, If I zoom I can see the names.