ggplot2 添加圈和pca3d 小笔记

1 ellipse .

library("ggplot2")
mtcars$cyl <- as.factor(mtcars$cyl)
head(mtcars)
ggplot(faithful,aes(waiting, eruptions)) + geom_point() + stat_ellipse()
p <- ggplot(faithful,aes(waiting, eruptions,color=eruptions > 3)) + geom_point()
p + stat_ellipse()
p + stat_ellipse(type="norm")

2. pca3d ,如果更美观的可以使用scatterplot3d
install.packages("pca3d")
library(pca3d)
data("metabo")
head(metabo)
metabo
pca <- prcomp(metabo[,-1], scale.=TRUE)
gr <- factor(metabo[,1])
pca
summary(gr)
pca3d(pca, group=gr)
 

你可能感兴趣的:(生物信息学)