Scatter-plot of data in which the cluster membership is coded by colors.
2 ビュー (過去 30 日間)
古いコメントを表示
Hello, I have created a dendrogram of my given data.
NumCluster = 1566;
dist = pdist(alldata, 'euclidean');
GroupsMatrix = linkage(dist, 'complete');
clust = cluster(GroupsMatrix, 'maxclust', NumCluster);
E = evalclusters(alldata,clust,'CalinskiHarabasz')
[H,T,perm] = dendrogram(GroupsMatrix, 1566, 'colorthreshold', 'default');
I want to create now a scatter-plot of the data in which the cluster membership is coded by colors. I have tried to implement it like this
gscatter (alldata(:,1),alldata(:,2), E.OptimalY,'rbgk','xod')
Update:
The error is now gone but all the scatter plot has the same color. How can I cluster the membership by different colors? And is my E chosen correctly for the number of clusters? For my E I have 1566 cluster. I did not know if this is okay.
2 件のコメント
the cyclist
2021 年 5 月 31 日
It can be difficult to diagnose issues without the data. Specifically, we don't see how E is defined. Can you upload the data, such that we can actually run your code and reproduce the error?
回答 (1 件)
KSSV
2021 年 6 月 1 日
編集済み: KSSV
2021 年 6 月 1 日
gscatter (alldata(:,1),alldata(:,2),clust,'rbgk','xod')
Check the option E.OptimalY, it is empty []. So all the points are shown by same color/ maekers.
3 件のコメント
KSSV
2021 年 6 月 1 日
編集済み: KSSV
2021 年 6 月 1 日
alldata = csvread('Data.csv') ;
NumCluster = 10; % <-----change cluster number here
dist = pdist(alldata, 'euclidean');
GroupsMatrix = linkage(dist, 'complete');
clust = cluster(GroupsMatrix, 'maxclust', NumCluster);
E = evalclusters(alldata,clust,'CalinskiHarabasz') ;
gscatter (alldata(:,1),alldata(:,2),clust)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!