简体   繁体   中英

How to label 5 specific points on PCA plot

I have used package ( tidyverse ) and just wanted to add labels to 5 specific points on this lot. I have tried the below code but it is not giving me any points. the data set is about 2000 observations over 21 variables.

BOTTOM=which(interest2$ID%in%project.pca$ID); 
text(which(interest2$ID%in%project.pca$ID)[BOTTOM,1], text(which(interest2$ID%in%project.pca$ID))[BOTTOM,2],text(which(interest2$ID%in%project.pca$ID)[BOTTOM,3],rownames(input)[BOTTOM],pos=1)

图片

With ggplot, Make the PCA plot first, and the add edition layer with dataframe with only those 5 points. Check out in this post for example

https://datavizpyr.com/how-to-add-labels-to-select-points-with-ggrepel/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM