Visualizing clusters in a two- or three-dimensional space gives more intuitive information to the observer in terms of the location of the data points in the feature space and the segregation and aggregation of these data points. The visualization usually consists of the location of a data point along the feature axis. Another interesting plot for clustering is the silhouette plot, which depicts the quality of clustering. In this recipe, we work on a few types of visualizations of the clusters in k-means as we have already seen the visualization specific to hierarchical clustering.
What we need for the visualization is the data and the cluster information. Here, we use our previous recipe as the input.