26
$\begingroup$

I have a data set with 16 variables, and after clustering by kmeans, I wish to plot the two groups.

What plots do you suggest to visually represent the two clusters?

$\endgroup$
0

3 Answers 3

32
$\begingroup$

There's no single right visualization. It depends on what aspect of the clusters you want to see or emphasize.

Do want to see how each variable contributes? Consider a parallel coordinates plot.

Parallel Coordinates for two clusters and cluster means

Do you want to see how clusters are distributed along the principal components? Consider a biplot (in 2D or 3D):

Cluster biplot

Do you want to look for cluster outliers over all dimensions. Consider a scatterplot of distance from cluster 1's center against distance from cluster's center 2. (By definition of K Means each cluster will fall on one side of the diagonal line.)

enter image description here

Do you want to see pairwise relations compared to the clustering. Consider a scatterplot matrix colored by cluster.

enter image description here

Do you want to see a summary view of the cluster distances? Consider a comparison of any distribution visualization, such as histograms, violin plots, or box plots.

enter image description here

$\endgroup$
2
  • $\begingroup$ thanks for the excellent response! although I must admit I don't understand the last one too well. Each grey-ish rectangle is a feature I assume? What does the y axis represent (and x for that matter?) $\endgroup$ Commented Apr 22, 2021 at 3:14
  • $\begingroup$ Can you also provide the coding reference to the same? $\endgroup$
    – Sachin
    Commented Apr 25, 2022 at 14:42
2
$\begingroup$

Multivariate displays are tricky, especially with that number of variables. I have two suggestions.

If there are certain variables that are particularly important to the clustering, or substantively interesting, you can use a scatterplot matrix and display the bivariate relationships between your interesting variables. You could even used enhanced scatterplots (e.g. use shapes with size proportional to a third variable) to add in some more dimensionality

Alternatively, you could use a springplot which was developed for displaying high dimensional data that exhibits clustering. Note, I have never seen this in the literature I am familiar with, but I think it is a very interesting way of displaying multivariate data. The following citation is where the plot was originally proposed.

Hoffman,P.E. et al. (1997) DNA visual and analytic data mining. In the Proceedings of the IEEE Visualization. Phoenix, AZ, pp. 437-441.

And here is where I originally found mention of it.

Now, fair warning, I haven't been able to find an implementation of springplots outside of Orange. Then again, I haven't searched that hard!

I am assuming that your data is real valued and continuous, if it is discrete or non-interval, so on so forth, I don't think either plots would be helpful.

$\endgroup$
1
2
$\begingroup$

You can use fviz_cluster function from factoextra pacakge in R. It will show the scatter plot of your data and different colors of the points will be the cluster.

To the best of my understanding, this function performs the PCA and then chooses the top two pc and plot those on 2D.

Any suggestion/improvement in my answer are most welcome.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.