文章预览
01 发散PCA散点图 PCA (Principal Component Analysis) 散点图,是科研文章中常见的一类散点图。下面就以PCA散点图为例,为大家介绍如何使用ggplot2绘制好看的散点图。 #读入数据; dt "PCA_data.csv") #载入ggplot2绘图包; library (ggplot2) library (ggh4x) #绘制实心散点图; p1 stat_centroid (aes(xend = PC1, yend = PC2, colour = Diagnosis), geom = "segment" , crop_other = F, alpha =0.3,size = 1,show.legend = F)+ geom_point (size=3,alpha=0.7, color = "white" ,shape = 21,show.legend = T)+ scale_color_manual (name= "" , values = c( "#FF9999" , "#c77cff" ))+ scale_fill_manual (name= "" , values = c( "#FF9999" , "#c77cff" ))+ scale_x_continuous (expand=expansion(add = c(0.7,0.7)), l
………………………………