Centroid values in a sample plot

Can you tell me how I can find the centroid value (coordinates for the centre of the stars) for the different groups from the MyResult.splsda list object ?
Or does the plotting function calculate this itself – if so I will need to calculate the centroid values myself from the x and y variates matrices ?

I want to follow the changes over time – measure the distance between the group centres.

Best regards

Roy

Hi @mixOmics_user,

You can save the plotIndiv() object and find the coordinates manually for each group by looking into each layer. I am pretty sure there are smarter ways to do this, but this is what i could come up with.

PlotObject <- plotIndiv(MyPLSDA, group = Y, star = T)

PlotObject[["graph"]][["layers"]][[1]][["data"]][["x0"]]
PlotObject[["graph"]][["layers"]][[1]][["data"]][["y0"]]

PlotObject[["graph"]][["layers"]][[2]][["data"]][["x0"]]
PlotObject[["graph"]][["layers"]][[2]][["data"]][["y0"]].. and so on

Hope it solved your problem, although it does not look elegant :slight_smile:

  • Christopher
1 Like