how to join the centroid to respective cluster points.

I have a data file carrying 30 points x,y coordinates in the manner
1 20 30
2 21 31
3 22 32... so on.
I am using following commands to cluster my data in n groups.sample.jpg
X=load('dabra_village_data.txt');
Y=pdist(X,'euclid');
Z=linkage(Y,'median');
T= cluster(Z,'cutoff',0.9)
x=X(:,2);
y=X(:,3);
indexstring =T(:,1);
gscatter(x,y,T)
Now T has the index of each point to which cluster it belongs to.
c1 matrix carries x y coordinates of centroids of each cluster.
plot(c1(:,1), c1(:,2),'*r')
I want to join these centroid points to their cluster points respectively in the same graph.

Answers (0)

Asked:

on 12 Feb 2019

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!