Find a variable in clustergram
7 views (last 30 days)
Show older comments
Luca D'Angelo
on 25 Mar 2024
Commented: Luca D'Angelo
on 12 Apr 2024
Hi all,
I have a huge database (8334x140) and I want to perform a hierarchical cluster analysis with the Clustergram function.
Cluster = clustergram(DB_hca,'RowLabels',FeatureNames,'ColumnLabels',string((DateTime)),...
'Standardize',2 ,'Colormap',jet,'RowPDist','euclidean','ColumnPDist','euclidean' ,...
'Linkage','ward','DisplayRange',1, 'Symmetric',1, 'Cluster',3);
Few questions:
1) how to save the clustergram as .fig and/or to save as a .jpg or another format (for example: I wanted to attached here but the only way is a screenshot and save it);
2) how to understand where is and visualize my Feature "Vattelapesca" (random name for a random feature that it is one of the 8334 rows)? I can look for it in Cluster.RowLabels but once I know that it is the 835 node, this is not helping me (especially if I have to look for 100 features and not only 1).
Any idea?
Cheers,
Luca
0 Comments
Accepted Answer
Maneet Kaur Bagga
on 28 Mar 2024
Hi Luca,
As per my understanding, you want to save the clustergram in different file formats and also looking for ways to visualize features within the clustergram output working with the large size of the dataset. Please refer to the following as a possible workaround for both the questions:
1) Saving clustergram as ".fig" and Exporting as ".jpg" or Other Formats:
To save the clustergram as a ".fig" fille, you can use "savefig" function in MATLAB which allows you to open it later in MATLAB for viewing or updating purpose. Once you have the ".fig" file you can save the figure in any other format using the "saveas" function.
savefig(Cluster, 'MyClustergram.fig');
2) Visualizing a Specific Feature
Extract the ordered row labels after clustering, it will give the position of the features after clustering. Then find the position of the features of interest in the ordered list. Once you get the positions, you can visually inspect the clustergram.
orderedLabels = Cluster.RowLabels;
featureIndex = find(strcmp(orderedLabels, 'Vattelapesca'));
Please refer to the following MathWorks documentation for further understanding:
Rowlabels property in clustergram: https://www.mathworks.com/help/bioinfo/ref/clustergram.html
Hope this helps!
More Answers (0)
See Also
Categories
Find more on Install Products in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!