library(“ggplot2“)
library(“gridExtra“)
library(ggbiplot)
library(“corrplot“)
library(factoextra)
#conversion of row number
data=rownames(GGE)=c(“Me“,“E6“,“E2“,“E4“,“KB“,“HUl“,“kat“,“Dan“,“EA2“,“Ts“,
“E0“,“E5“,“DI“,“E8“,“E39“,“ET1“,“BO“,“Ab“,“Si“)
pca =prcomp(GGE[,c(2:11)], center = TRUE,scale. = TRUE)
print(pca)
# to get eigen value
= get_eigenvalue(pca)
#to get scree plot
fviz_eig(pca, addlabels = TRUE, ylim = c(0, 50))
## PCA results for variables
var=get_pca_var(pca)
# to see the most contributing variables for each dimension
corrplot(var$cos2, =FALSE)
#to see the most contributing variables for both dimension
fviz_cos2(pca, choice = “var“, axes = 1:2)
# to draw a bar plot of variable contributions
# Contributions of variables to PC1
a=fviz_contrib(pca, choice = “var“, axes = 1)# top= 5 to limit to five var.
# Contributions of variables to PC2
b=fviz_contrib(pca, choice = “var“, axes = 2)
(a,b, ncol=2, top=’Contribution of the variables to the first two PCs’)
# Total contribution on PC1 and PC2
fviz_contrib(pca, choice = “ind“, axes = 1:2)
#Graph of variables
fviz_pca_var(pca,
= “cos2“,
= c(“red“, “blue“, “green“),
repel = TRUE)
#Biplot of individuals and variables
fviz_pca_biplot(pca, repel = TRUE,
= “blue“,
= “red“)
#########################################################################
#Plotting PCA
ggbiplot(pca)
#This will name each point with the name of the genotypes
ggbiplot(pca,labels=rownames(GGE))
# plot using PC1 and PC2
ggbiplot(pca,ellipse=TRUE,choices=c(1,2),labels=rownames(GGE), groups=GGE$ENV)
# scale the samples
ggbiplot(pca,ellipse=TRUE, = 2, = 4.5,
labels=rownames(GGE), groups=GGE$ENV)
#remove the arrows altogether
ggbiplot(pca,ellipse=TRUE, = 1, = 1,=FALSE,
labels=rownames(GGE), groups=GGE$ENV)
# final biplot by Customize ggbiplot
aa=ggbiplot(pca,ellipse=TRUE, = 1, = 1, labels=rownames(GGE), groups=GGE$ENV)
scale_colour_manual(name=“Location“, values= c(“blue“, “red“, “green“,“pink“))
ggtitle(“PCA of wakjira“)
theme_minimal()
theme( = “bottom“)
aa
ggsave(filename = ““, plot = aa,width = 22, height = 15, dpi = 2500, units = “cm“)
1 view
817
233
2 months ago 00:03:35 1
NAGANO TONIC REVIEW [BEWARE!] Nagano Tonic Reviews Does It REALLY Work - BUY NAGANO LEAN BODY TONIC
2 months ago 00:03:00 1
Ernst Toch - Geographical Fugue (1930) Score
3 months ago 00:08:28 1
Artificial Intelligence for Congressional Bills in 2024