前期处理:https://www.jianshu.com/p/fef17a1babc2
#可视化对每个主成分影响比较大的基因集
001、
dat <- pbmc[["pca"]]@feature.loadings ## 数据来源 dat[1:3, 1:3] dat <- dat[order(-dat[,1]),][1:29,1] dat <- as.data.frame(dat) dat <- cbind(gene = rownames(dat), dat) dat <- rbind(dat, MALAT1 = c("MALAT1", -0.10)) ## ???? dat$num <- nrow(dat):1 par(mai = c(1, 1, 1, 1),mgp = c(2.5,0.7,0)) plot(dat$dat,pch = 19, dat$num, yaxt ="n", xlab = "PC_1", ylab = "") axis(2, 1:30, rev(dat$gene), col.axis = "black", las = 2) ## 绘图
标准结果:
VizDimLoadings(pbmc, dims = 1, reduction = "pca")