【发布时间】:2021-10-12 05:29:21
【问题描述】:
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)
【问题讨论】:
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)
【问题讨论】:
尝试添加geom_point(aes(shape=factor(something)))。以iris 数据为例,
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)))
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"))
【讨论】:
guides(color = "none"),要删除形状图例,使用guides(shape = "none")。为了重命名标题和因子名称,我添加了上面的代码
theme(text = element_text(family = "mono")) 将更改字体,+ggtitle("aaa") 将添加标题。