MATLAB: Labeling Dendrogram Plot x-axis

clusteranalysisdendrogramfisheririslabel;Statistics and Machine Learning Toolbox

Hello,
i worked me trough the example on how to make clusteranalysis
everything works fine except that i cant label my x-axis (hirachical clustering). so i have now the clutered tree but i dont know what 'branch' belongs to my rawdata. so lets say i have a data matrix of 6 colums and 40 rows, and i cant link the actual data to one of the branches because branch one on the plot is not necessarely the first row in my matrix
has anybody an idea how to solve this? thank you in advance
load fisheriris
eucD = pdist(meas,'euclidean');
clustTreeEuc = linkage(eucD,'average');
[h,nodes] = dendrogram(clustTreeEuc,0);
set(gca,'TickDir','out','TickLength',[.002 0],'XTickLabel',[]);

Best Answer

You can try this:
> [h,nodes,orig] = dendrogram(clustTreeEuc,0);
>> orig(1:5)
ans =
102 143 114 122 115
These are the first five points (using original row numbers) on the dendrogram. If you zoom into the cluttered plot, you will see the first points are labeled this way. Now unclutter using:
>> set(gca,'XTickMode','auto','XTickLabelMode','auto');
Now the first five points are at positions 1,2,3,4,5. Zoom out. The graph is uncluttered. You can determine the identity of any leaf node by finding its x value (zooming if necessary) and looking up the original row number in the orig vector.