MATLAB Answers

huda nawaf

how show the clusters graphically?

Asked by huda nawaf
on 12 Aug 2012


I got the indices of clusters of my data. I would like to see the result with drawing. i.e I hope to see the clusters graphically.

can do that?

thanks in advance




No products are associated with this question.

3 Answers

Answer by per isakson
on 13 Aug 2012

A search for "cluster" refined by Graphics in the File Exchange finds twenty contributions.

... and the statistical toolbox


thanks, I visited that link and run plotcluster:

but I confused with the first input of this function, the author said that the first input must be n*2 or n*3 and do not know exactly what are the elements of n*2 or n*3 if n is the number of observations , is that meaning I have to creat array with size 6*2 , because i have for examplr 6 observations and the matrix be data=[1 1;2 2 ; 3 3; 4 4; 5 5; 6 6]

I'm not sure, if that proper or not.

Look at the Description at that link. It describes exactly what each of the parameters means.

There are no clusters in that data because your data is uniformly spaced. Or there are 6 clusters with just one point in them, or one big cluster with 6 points. You don't really have aggregation or clumping of any of the points.

Answer by Ilya
on 13 Aug 2012

Huda, when I answered your other question, I suggested that you run 'doc linkage' and gave you a link to the web doc for that function. At the bottom of that page, you can see examples of two different plots. Are you asking for a plot that is not on that page?


i saw , but I think scatter do not work with my case. please see comments below with image analyst


on 13 Aug 2012

Use gscatter.

Answer by Image Analyst
on 13 Aug 2012

Why not just use the scatter() function? If that doesn't work, then explain why not, and use more words to do it.


walter, I need my clusters like this image


Once you know the centers and radius, you can use rectangle() or check the FAQ to draw the colored circles. Try it.

on 31 Aug 2012
load fisheriris
d = pdist(meas);
Z = linkage(d);
c = cluster(Z,'maxclust',4);
Y = cmdscale(d);

Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!