Make silhouette plot legible for k-means

I am trying to make a silhouette plot for a k-means clustering, but the bars are almost invisble. How can I make this chart legible?

Example code:

require(cluster)

X <- EuStockMarkets
kmm <- kmeans(X, 8)

D <- daisy(X)
plot(silhouette(kmm$cluster, D), col=1:8)

Example output:

Answers


To fix this, set the border to NA:

plot(silhouette(kmm$cluster, D), col=1:8, border=NA)


Really new to R, so I might be on the wrong track. Could you specify the column colors? Something like:

require(cluster)

X <- EuStockMarkets
kmm <- kmeans(X, 8)

D <- daisy(X)
plot(silhouette(kmm$cluster, D), col = c("blue","red","purple","green","black","pink","peach","orange")

I just learned that colors() shows the color options in R.

The idea above isn't a complete solution, as I'm not sure how to select columns 1 through 8 AND select colors for them. Plus, I'm sure there's a way for R to show the clusters in different colors automatically.


Need Your Help

How to call Ajax function recursively

php javascript ajax

I want to know how to call Ajax function Recursively.