PC_values_for_R_25_11 <- read_excel("PC_values_for_R_25_11.xls", col_types = c("text", "text", "text", "text", "numeric", "numeric", "numeric", "numeric", "numeric")) data <- PC_values_for_R_25_11 # Seperate data data_p1dac <- subset(data, LegElement == "P1 dactylus") data_p6dac <- subset(data, LegElement == "P6 dactylus") data_p1prop <- subset(data, LegElement == "P1 propodus") data_p6prop <- subset(data, LegElement == "P6 propodus") data_p1car <- subset(data, LegElement == "P1 carpus") data_p6car <- subset(data, LegElement == "P6 carpus") data_p1dacA <- subset(data, LegElement == "P1 dactylus" & Adult_Immature == "Adult") data_p6dacI <- subset(data, LegElement == "P6 dactylus" & Adult_Immature == "Immature") data_p1dacI <- subset(data, LegElement == "P1 dactylus" & Adult_Immature == "Immature") data_p6dacA <- subset(data, LegElement == "P6 dactylus" & Adult_Immature == "Adult") data_p1dace <- subset(data, LegElement == "P1 dactylus" & AttachmentSite == "External") data_p1dacAe <- subset(data, LegElement == "P1 dactylus" & AttachmentSite == "External" & Adult_Immature == "Adult") data_p1dacIe <- subset(data, LegElement == "P1 dactylus" & AttachmentSite == "External" & Adult_Immature == "Immature") data_p1dacbu<- subset(data, LegElement == "P1 dactylus" & AttachmentSite == "Buccal") data_p1dacAbu<- subset(data, LegElement == "P1 dactylus" & AttachmentSite == "Buccal"& Adult_Immature == "Adult") data_p1dacIbu<- subset(data, LegElement == "P1 dactylus" & AttachmentSite == "Buccal"& Adult_Immature == "Immature") data_p1dacbr<- subset(data, LegElement == "P1 dactylus" & AttachmentSite == "Branchial") data_p1dacAbr<- subset(data, LegElement == "P1 dactylus" & AttachmentSite == "Branchial" & Adult_Immature == "Adult") data_p1dacIbr<- subset(data, LegElement == "P1 dactylus" & AttachmentSite == "Branchial" & Adult_Immature == "Immature") #Connect the dots hullp1dacA <- data_p1dacA %>% group_by (AttachmentSite) %>% slice(chull(PC1, PC2)) hullp1dacI <- data_p1dacI %>% group_by (AttachmentSite) %>% slice(chull(PC1, PC2)) hullp1dacAe<- data_p1dacAe %>% group_by (Adult_Immature) %>% slice(chull(PC1, PC2)) hullp1dacIe<- data_p1dacIe %>% group_by (Adult_Immature) %>% slice(chull(PC1, PC2)) hullp1dacIbu<- data_p1dacIbu %>% group_by (Adult_Immature) %>% slice(chull(PC1, PC2)) hullp1dacAbu<- data_p1dacAbu %>% group_by (Adult_Immature) %>% slice(chull(PC1, PC2)) hullp1dacIbr<- data_p1dacIbr %>% group_by (Adult_Immature) %>% slice(chull(PC1, PC2)) hullp1dacAbr<- data_p1dacAbr %>% group_by (Adult_Immature) %>% slice(chull(PC1, PC2)) #Data plot #Polygon all ggplot(data_p1dac, aes(x=PC1, y=PC2, color=AttachmentSite, fill=AttachmentSite, label=Species))+ geom_point()+ #geom_line(aes(group=Species))+ theme_classic()+ geom_polygon(data=hullp1dacA, alpha=0.5)+ geom_polygon(data=hullp1dacI, alpha=0.1)+ #geom_text(size = 2.5) geom_text_repel(direction = "both", size = 3.0) #Polygon adults ggplot(data_p1dacA, aes(x=PC1, y=PC2, color=AttachmentSite, fill=AttachmentSite, label=Species))+ geom_point()+ #geom_line(aes(group=Species))+ theme_classic()+ geom_polygon(data=hullp1dacA, alpha=0.5)+ #geom_text(size = 2.5) geom_text_repel(direction = "both", size = 3.0) #Polygon Adult_Immature external ggplot(data_p1dace, aes(x=PC1, y=PC2, color=Adult_Immature, fill=Adult_Immature, label=Species))+ geom_point(color= "blue")+ #geom_line(aes(group=Species))+ theme_classic()+ geom_polygon(data=hullp1dacAe, alpha=0.5, fill= "blue", color= "blue")+ geom_polygon(data=hullp1dacIe, alpha=0.1, fill= "blue", color= "blue")+ #geom_text(size = 2.5) geom_text_repel(direction = "both", size = 3.0, color= "blue") #Polygon Adult_Immature buccal ggplot(data_p1dacbu, aes(x=PC1, y=PC2, color=Adult_Immature, fill=Adult_Immature, label=Species))+ geom_point(color= "green")+ #geom_line(aes(group=Species))+ theme_classic()+ geom_polygon(data=hullp1dacAbu, alpha=0.5, fill= "green", color= "green")+ geom_polygon(data=hullp1dacIbu, alpha=0.1, fill= "green", color= "green")+ #geom_text(size = 2.5) geom_text_repel(direction = "both", size = 3.0, color= "green") #Polygon Adult_Immature branchial ggplot(data_p1dacbr, aes(x=PC1, y=PC2, color=Adult_Immature, fill=Adult_Immature, label=Species))+ geom_point(color= "red")+ #geom_line(aes(group=Species))+ theme_classic()+ geom_polygon(data=hullp1dacAbr, alpha=0.5, fill= "red", color= "red")+ geom_polygon(data=hullp1dacIbr, alpha=0.1, fill= "red", color= "red")+ #geom_text(size = 2.5) geom_text_repel(direction = "both", size = 3.0, color= "red")