【发布时间】:2013-12-10 09:08:27
【问题描述】:
如何将样本 ID(行号)作为标签添加到此 LDA 图中的每个点?
library(MASS)
ldaobject <- lda(Species~., data=iris)
plot(ldaobject, panel = function(x, y, ...) points(x, y, ...),
col = as.integer(iris$Species), pch = 20)
【问题讨论】:
如何将样本 ID(行号)作为标签添加到此 LDA 图中的每个点?
library(MASS)
ldaobject <- lda(Species~., data=iris)
plot(ldaobject, panel = function(x, y, ...) points(x, y, ...),
col = as.integer(iris$Species), pch = 20)
【问题讨论】:
您可以在面板功能中使用text:
library(MASS)
ldaobject <- lda(Species~., data=iris)
plot(ldaobject,
panel = function(x, y, ...) {
points(x, y, ...)
text(x,y,labels=seq_along(x),...) ## You change labels here
}
,
col = as.integer(iris$Species), pch = 20)
【讨论】: