[R] How to show clustering results?

Peng Yu pengyu.ut at gmail.com
Sat Oct 3 18:29:21 CEST 2009


Hi,

I know the following code can show the dendrogram. But I also want to
plot the points on a figure and have circles (or boxes) around the
points in a cluster (see
http://www.autonlab.org/tutorials/kmeans11.pdf for some examples). I
am wondering how to do so in R.

Regards,
Peng

x1 = c(0,0)
x2 = c(1,0)
x3 = c(.2,2)
x4 = c(.8,2)
png('hclust_complete.png')
plot(hclust(dist(rbind(x1,x2,x3,x4)),method = 'complete'))
dev.off()

png('hclust_average.png')
plot(hclust(dist(rbind(x1,x2,x3,x4)),method = 'average'))
dev.off()




More information about the R-help mailing list