[R] R-help Digest, Vol 28, Issue 28
A. Mani
a_mani_sc_gs at vsnl.net
Wed Jun 29 00:22:31 CEST 2005
On Tuesday 28 June 2005 15:30, r-help-request at stat.math.ethz.ch wrote:
Re : 37. Re: A. Mani : colours in Silhouette (Mulholland, Tom)
>
> Message: 37
> Date: Tue, 28 Jun 2005 09:08:24 +0800
> From: "Mulholland, Tom" <Tom.Mulholland at dpi.wa.gov.au>
> Subject: Re: [R] A. Mani : colours in Silhouette
> To: <a_mani_sc_gs at vsnl.net>, <r-help at stat.math.ethz.ch>
> Message-ID:
> <4702645135092E4497088F71D9C8F51A128BAF at afhex01.dpi.wa.gov.au>
> Content-Type: text/plain; charset="iso-8859-1"
>
> 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.
>
> args(cluster:::plot.silhouette)
>
> > 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, ...)
>
>
> data(ruspini)
> pr4 <- pam(ruspini, 4)
> si <- silhouette(pr4)
> plot(si,col = "red")
>
I tried that before with many more options and got a blank image. It must have
been due to the options.
> 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'."
>
> Tom
>
> Thanks for that I found out something I will find useful in the future.
>
> > -----Original Message-----
> > From: r-help-bounces at stat.math.ethz.ch
> > [mailto:r-help-bounces at stat.math.ethz.ch]On Behalf Of A. Mani
> > Sent: Tuesday, 28 June 2005 4:30 AM
> > To: r-help at stat.math.ethz.ch
> > 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
More information about the R-help
mailing list