Re: [R] A. Mani : colours in Silhouette

From: Mulholland, Tom <>
Date: Tue 28 Jun 2005 - 11:08:24 EST

It's not so much a problem, as not working the way you expected. cluster:::plot.partition is used to do the plotting. If you look at the code for this you can see the difficulty in putting every possible permutation into the code. If for example you want the silhouette plot to be red using col = "red" is not intuitive as the cluster plot (which comes up first) has more than one colour. If you have a look at methods(plot) (assuming that you have loaded the cluster package) you will see that there is a specific piece of code in the form of plot.silhouette. It has an asterisk next to it so you need to use cluster:::plot.silhouette to see the code. It has what you need.

> function (x, nmax.lab = 40, max.strlen = 5, main = NULL, sub = NULL,

    xlab = expression("Silhouette width " * s[i]), col = "gray",     do.col.sort = length(col) > 1, border = 0, cex.names = par("cex.axis"),     do.n.k = TRUE, do.clus.stat = TRUE, ...)


      pr4 <- pam(ruspini, 4)
      si <- silhouette(pr4)
      plot(si,col = "red")

The issue is that whenever code is written there is always a choice as to what functionality is put in place. Just because something can be done, does not mean it will or in some cases should be done. In this case the help for plot.partition notes that "For more flexibility, use 'plot(silhouette(x), ...)', see 'plot.silhouette'."


Thanks for that I found out something I will find useful in the future.

> -----Original Message-----
> From:
> []On Behalf Of A. Mani
> Sent: Tuesday, 28 June 2005 4:30 AM
> To:
> Subject: [R] A. Mani : colours in Silhouette
> Hello,
> In cluster analysis with cluster, how does one colour
> the silhouette
> plots ? For example in using pam. There seems to be some
> problem there.
> Everything else can be coloured.
> Thanks,
> A. Mani
> Member, Cal. Math. Soc
> ______________________________________________
> mailing list
> PLEASE do read the posting guide!
> mailing list PLEASE do read the posting guide! Received on Tue Jun 28 11:12:27 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:33:03 EST