View source: R/plot_silhouette.R
| plot_silhouette | R Documentation |
Plots the silhouette diagram for a given clustering result.
plot_silhouette(sil)
sil |
A silhouette object as returned by |
A silhouette plot if input is not NULL, otherwise a placeholder text.
data <- scale(iris[, 1:4])
cl <- kmeans(data, 3)$cluster
sil <- cluster::silhouette(cl, dist(data))
if (interactive()) {
plot_silhouette(sil)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.