I can't replicate this with the toy data in geomorph:

library(geomorph)
data("plethodon")
gpa=gpagen(plethodon$land)

Performing GPA
  
|===============================================================================================================================|
 
100%

Making projections... Finished!
pca=gm.prcomp(gpa$coords)
cols=c(rep('black', 20), rep('red', 20))
plot(pca, col=cols, pch=20)

seems to give the expected figure with 20 black and red points. So I 
suspect it is an issue with your data ordering. Perhaps you do not have 60 
points. I noticed that plot is not throwing an error when the length of the 
color vector is longer than the number of points to plot. 

On Sunday, November 26, 2023 at 1:39:30 PM UTC-8 Mauro Cavalcanti wrote:

> Dear ALL,
>
> In a GM study of 60 specimens of two fish species (with 30 specimens for 
> each species), I am using the gm.prcomp() function in the geomorph 4.0.6 
> package to perform an ordinary PCA of the Procrustes-aligned coordinates 
> (where 'proc' is my GM data frame):
>
> PCA <- gm.prcomp(proc$coords)
> summary(PCA)
>
> I want that the two species appear in different colors in the PCA plot, so 
> I used:
>
> plot(PCA, pch = 20, col = c(rep("red", 30), rep("black", 30))) 
>
> or:
>
> plot(PCA, pch = 20, col = df$species) (where 'df' is my original data 
> frame)
>
> But strangely in neither case the plot is correctly displayed (see the 
> attached figures): just a few points appear in either "red" or "black", 
> instead of the expected result of 30 points in one color and 30 points in 
> another.
>
> Any hints?
>
> Thanks in advance for any assistance you can provide.
>
> With best regards,
>
> -- 
> Dr. Mauro J. Cavalcanti
> E-mail: [email protected]
> Web: https://github.com/maurobio
> "Life is complex. It consists of real and imaginary parts."
>

-- 
You received this message because you are subscribed to the Google Groups 
"Morphmet" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/morphmet2/a026ad3b-eadc-4047-86f3-cfcb62bd298dn%40googlegroups.com.

Reply via email to