To analyze exactly what is happening to the boundaries of the clusters, in order to understand how well they are separated, we can make a silhouette plot using cluster indices issued by kmeans(). The silhouette plot displays a measure of how close each point in one cluster is to points in neighboring clusters. The silhouette() function plots cluster silhouettes for the data matrix provided, with clusters defined. Rows of the input matrix correspond to points; columns correspond to coordinates.
The cluster defined can be a categorical variable, numeric vector, character matrix, or cell array of character vectors containing a cluster name for each point. The silhouette() function treats NaNs or empty character vectors in ...