user3570187
user3570187

Reputation: 1773

Naming the clusters in silhouette plot

I am trying to name the clusters in the silhouette plot. Can some one suggest how i can name each silhouette cluster?

library(cluster)
data(ruspini)
pr4 <- pam(ruspini, 4)
str(si <- silhouette(pr4))
plot(si, col = c("red", "yellow", "blue", "purple"))# with cluster-wise coloring

Upvotes: 1

Views: 493

Answers (1)

Marcin
Marcin

Reputation: 8044

It can't be changed since the names on the plot are values from the column cluster in si which is a matrix with doubles. If you would coeerce this column, whole matrix would coerce to type character and then the plot function for silhouette object would not work.

library(cluster)
data(ruspini)
pr4 <- pam(ruspini, 4)
str(si <- silhouette(pr4))
plot(si, col = c("red", "yellow", "blue", "purple"))# 
typeof(si)
si

Upvotes: 1

Related Questions