Home > OS >  How to change symbols of points for PCA ggplot?
How to change symbols of points for PCA ggplot?

Time:10-12

biplot<-ggbiplot(pcobj = PCA,choices= c(1,2),scale = 1,groups = Fdata$Tissue,ellipse = TRUE)  
geom_vline(xintercept = 0, linetype = 3) geom_hline(yintercept = 0, linetype = 3)         

  

CodePudding user response:

try add geom_point(aes(shape=factor(something))). For an example of iris data,

library(ggbiplot)

ir.pca <- prcomp(iris[,1:4], center = TRUE,scale. = TRUE) 

ggbiplot(ir.pca, obs.scale = 1, var.scale = 1,groups = iris$Species, ellipse = TRUE) geom_point(aes(shape=factor(iris$Species)))

enter image description here

ggbiplot(ir.pca, obs.scale = 1, var.scale = 1,groups = iris$Species, ellipse = TRUE, labels = ) geom_point(aes(shape=factor(iris$Species))) guides(color = "none", shape = guide_legend(title = "New")) scale_shape_discrete(labels = c("a", "b", "c"))

enter image description here

  • Related