everyone. I have a problem in plotting silhouette chart in R.
It is my code.
#k-means clustering
#install.packages("cluster")
library(cluster)
kc <- kmeans(nsoap, centers=3)
dissE <- daisy(nsoap)
sk <- silhouette(kc$cl,dissE)
plot(sk)
dev.off()
I just got this result. It is without the contents...
How can I overcome this problem?
Thank you:)
Posting answer as this was the top result for a google search on this problem.
This is an issue with how the plot is rendered in RStudio.
This post (https://stackoverflow.com/a/34404740/7687105) shows how to set border = NA in the call to plot() to cause the plot to render correctly.
Another option used here (https://stackoverflow.com/a/34110332/7687105) is to call windows() in RStudio to get a separate window for graphics that plots the Silhouette Coefficients correctly without using the border= option.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With