# Example
library(WallomicsData)
library(kpcaIG)
library(ggplot2)
library(kernlab)
Transcriptomics_Stems_s <- scale(Transcriptomics_Stems)
kpca_tan <- kernelpca(as.matrix(Transcriptomics_Stems_s),
kernel = "tanhdot",
kpar = list(scale = 0.0001, offset = 0.01))
ggplot(data = data.frame(rotated(kpca_tan), Genetic_Cluster),
aes(x = X1, y = X2, shape = Genetic_Cluster)) +
geom_point(size = 2, aes(color = Genetic_Cluster)) +
xlab("1st kernel PC") +
ylab("2nd kernel PC") +
labs(color = "Genetic_Cluster", shape = "Genetic_Cluster") +
theme_minimal()
ggplot(data = data.frame(rotated(kpca_tan), Ecotype),
aes(x = X1, y = X2, shape = Ecotype)) +
geom_point(size = 2, aes(color = Ecotype)) +
xlab("1st kernel PC") +
ylab("2nd kernel PC") +
labs(color = " Ecotype", shape = " Ecotype") +
theme_minimal()
#Equivalently with function plot_kpca2D
plot_kpca2D(kpca_tan, groups = Genetic_Cluster)
plot_kpca2D(kpca_tan, groups = Ecotype)
Run the code above in your browser using DataLab