MATLAB: Add xticks to a clustergram

Bioinformatics Toolboxclustergramxticks

Hi,
I'm looking for a way to add xticks to a clustergram which I am creating using the function clustergram.
I simply want xticks from 0 to 4000 in spaces of 500, but could not find this option in the function.
Thanks a lot!

Best Answer

Clustergrams use a heatmap object which is notoriously difficult to customize. The numeric labels along the rows and columns can be considered as 'XTickLabels' or 'YTickLabels' and they do not appear if the number of rows or columns becomes large. Here's a demo that shows how to display every n-th tick label along the x axis.
% Create dense clustergram
% The x tick labels will not appear due to having too many columns
data = rand(20,2000);
h = clustergram(data)
% Get heatmap axes handle
% If more than 1 clustergram exists, it will get
% the heatmap to the first clustergram listed
cgFig = findall(0,'Type','Figure','Tag','Clustergram'); %handle to clustergram figure
hpAx = findall(cgFig(1),'Type','Axes','Tag','HeatMapAxes'); %Heatmap axis handle
% Turn on selected x-tick labels: every 100_th tick will be displayed
selection = 1:100:numel(h.ColumnLabels);
hpAx.XTick = selection;
% If you want to override their values with the
% index values, left to right
hpAx.XTickLabels = selection;