在双图中标记点 [英] Labeling points in a biplot
本文介绍了在双图中标记点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经执行了 PCA 并在 R
中绘制了一个双标图.
I have performed a PCA and drawn a biplot in R
.
pca1= princomp (~ data$X250 + data$X500 + data$shear, scores=TRUE, cor=TRUE, rownames=data[,1])
biplot(pca1, xlab="PC 1", ylab="PC 2", pch=20)
目前双图上的标签是行号,但我希望点标签是我的数据的绘图名称.我的数据有 81 行.
Currently the labels on the biplot are the row numbers, but I would like the point labels to be the plot names of my data. My data has 81 rows.
我试过了:
text (pca1[1:81], pca1[1:81], labels = row.names(data))
text (1:81, 1:81, labels = row.names(data))
text (pca1$comp.1[1:81], pca1$comp.2[1:81], labels = row.names(data))
推荐答案
尝试给予
rownames(data)<-data[,1]
在使用 princomp 之前
before using princomp
这篇关于在双图中标记点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文