Hi Rebeka,
In Morpho, after running procSym the shapes are aligned by the principal
axis of the first specimen.
library(Morpho)
library(Arothron)
#load example data
data("Lset3D_array")
#gpa + pca
gpa<-procSym(Lset3D_array)
#shape variations
minpc1<-restoreShapes(min(gpa$PCscores[,1]),gpa$PCs[,1],gpa$mshape)
maxpc1<-restoreShapes(max(gpa$PCscores[,1]),gpa$PCs[,1],gpa$mshape)
#plot shape variations
deformGrid2d(minpc1[,c(1,2)],maxpc1[,c(1,2)])
deformGrid2d(minpc1[,c(1,3)],maxpc1[,c(1,3)])
deformGrid2d(minpc1[,c(2,3)],maxpc1[,c(2,3)])
#anyway, you can use prcomp to align a set along its principal axes
set<-Lset3D_array[,,4]
plot(set[,1:2],asp=1)
Set<-prcomp(set,scale. = FALSE,center=TRUE)$x
plot(Set[,c(1,2)],asp=1)
plot(Set[,c(1,3)],asp=1)
plot(Set[,c(2,3)],asp=1)
#another example: align shape variations along the principal axes of the
mean shape
#gpa + pca
gpa<-procSym(Lset3D_array)
#shape variations
minpc1<-restoreShapes(min(gpa$PCscores[,1]),gpa$PCs[,1],gpa$mshape)
maxpc1<-restoreShapes(max(gpa$PCscores[,1]),gpa$PCs[,1],gpa$mshape)
#mshape
mshape<-gpa$mshape
#pca on mshape
Mshape<-prcomp(mshape,scale. = FALSE,center=TRUE)$x
#gpa step
Minpc1<-rotonto(Mshape,minpc1,scale = FALSE)$yrot
Maxpc1<-rotonto(Mshape,maxpc1,scale= FALSE)$yrot
#shape variations
deformGrid2d(Minpc1[,c(1,2)],Maxpc1[,c(1,2)])
deformGrid2d(Minpc1[,c(1,3)],Maxpc1[,c(1,3)])
deformGrid2d(Minpc1[,c(2,3)],Maxpc1[,c(2,3)])
Best,
Antonio
On Tue, 16 Nov 2021 at 22:29, Rebeka Rmoutilová <[email protected]>
wrote:
> Hi!
>
> in MorphoJ, shape changes of 3D objects are plotted on a plane according
> to principal components of the object. I am wondering whether there is a
> way how to do the same in R. I looked at geomorph and Morpho, but I found
> that I can only deform a 3D object, but I cannot do the projection to 2D as
> in MorphoJ. I found the projection to 2D quite good for vizualizing 3D
> objects because the vizualizations are in a standardized position.
>
> Thanks for any answer!
> Rebeka
>
> --
> 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/6ad17598-f06c-490b-8d46-e3df5b101d8fn%40googlegroups.com
> <https://groups.google.com/d/msgid/morphmet2/6ad17598-f06c-490b-8d46-e3df5b101d8fn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
--
Antonio Profico
PhD
Palaeohub – Department of Archaeology
University of York
morphomap: https://twitter.com/morphomap
twitter: https://twitter.com/ProficoA
--
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/CANuUiO%2BTbeLqt9bGnJMdgsTFARWGUzZaAJRqJeLHE6fTVEs36w%40mail.gmail.com.