Confidence ellipse PCA plot from Geomorph

266 views
Skip to first unread message

laura A-S

unread,
Jun 18, 2020, 2:22:57 PM6/18/20
to ggplot2
Hi!

I am wanting to add 95% confidence ellipses for the groups within my PCA plots that I have generated in Geomorph and this package appears to have no function to add these but I am aware this can be done in ggplot. From my online research I cannot find a method of keeping my PCA plots from Geomorph and adding confidence ellipse, I can only find methods that involve redoing all my PCA plots in a different package so I am hoping someone knows a way of doing this! Attached is one of my plots for reference.

Here is my code:

library(geomorph)
library(MASS)

mydata <- readland.tps("Flipper Ratios LM 22.TPS", specID = "ID")
coords <- as.matrix(mydata)

Flipratioslabel <- read.csv("Classifier flipper ratios.csv", header = TRUE)
is.factor(Flipratioslabel$Morphotype)

# Perform procrustes alignment and do Principal Components Analysis ---------------
flipperratios.gpa <- gpagen(mydata, print.progress = FALSE)
summary(flipperratios.gpa)
plotAllSpecimens(flipperratios.gpa$coords, mean = TRUE, links = NULL, label = TRUE, plot.param = list())

# PCA ------------------------------------------------------------------------------
flipperratios.pca <-plotTangentSpace(flipperratios.gpa$coords, label = TRUE, axis1 = 2, axis2 = 3, groups = Flipratioslabel$Morphotype, legend = TRUE)

Thanks in advance!!

PCA 1 2.png

FELIX Lankester

unread,
Jun 21, 2020, 10:08:41 AM6/21/20
to 'laura A-S' via ggplot2
I will be out of the office and unable to respond to emails until Monday 22nd June. Best wishes, Felix
> --
> --
> You received this message because you are subscribed to the ggplot2 mailing list.
> Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
>  
> To post: email ggp...@googlegroups.com
> To unsubscribe: email ggplot2+u...@googlegroups.com
> More options: http://groups.google.com/group/ggplot2
>
> ---
> You received this message because you are subscribed to the Google Groups "ggplot2" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+u...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/ggplot2/30405c32-557a-471b-9ce6-c2c9546bf62ao%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages