Home > front end >  How to create this multiple scatter plots in mclust package in r?
How to create this multiple scatter plots in mclust package in r?

Time:12-14

I use MCLUST and specifically specify K=3 clusters, with the covariance matrix type is VII.

library(mclust)
mc <- Mclust(iris[,-5],  G = 2)

How to create a figure like below? It's from my textbook: Applied Multivariate Statistical Analysis by Johnson and Wichern. Notice that this figure has 2 clusters (squares and triangles) in each figure. So the textbook has a mistake here. The textbook used 2 clusters.

enter image description here

CodePudding user response:

If you would like to modify the shape based on cluster assignment, you can do so through the use of pch. Using your data:

pairs(mc$data, pch = mc$classification)

enter image description here

If you want to change the shapes, you can map the classification assignment to the desired shape.

  • Related