MATLAB: Hot to get an xlabel on a clustergram object

Bioinformatics ToolboxclustergramMATLAB

I have added and xlabel to a clustergram using addXlabel, but it disappears after "print to Figure". If I add a title using addTitle, this works fine If I add ylabel it is not visible at all Matlab version R 2013b
code: TM = clustergram(TMDS,'linkage','ward',… 'ColumnPdist','seuclidean','Cluster','col',… 'Dendrogram','default','RowLabels',labelsRow,'ColumnLabels',labelsCol,… 'Colormap', redbluecmap); cm = struct('GroupNumber',{8 9},'Annotation',{'A' 'B'},'Color',{'r','b'}); TM.RowGroupMarker = cm; addXLabel(TM, 'days')
>> size(TMDS)
ans =
11 23
>> class(TMDS)
ans =
double

Best Answer

How to add an XLabel | YLabel | Title to a clustergram
Demo:
cgo = clustergram(rand(20,20));
addXLabel(cgo, 'X LABEL')
addYLabel(cgo, 'Y LABEL')
addTitle(cgo, 'TITLE')
How to access XLabel | YLabel | Title to a clustergram
2 Methods:
1) save the output handles to the addXLabel, addYLabel, addTitle function.
2) get the axis handle using findall along with the axis tag.
Demo:
% METHOD 1
cgo = clustergram(rand(20,20));
xlbl = addXLabel(cgo, 'X LABEL');
ylbl = addYLabel(cgo, 'Y LABEL');
ttl = addTitle(cgo, 'TITLE');
% METHOD 2
cgfig = findall(0,'type','figure', 'Tag', 'Clustergram'); % Fig handle
cgax = findobj(cgfig, 'type','axes','tag','HeatMapAxes'); % Axis handle
cgax.XLabel
cgax.YLabel
cgax.Title
Related Question