线性判别分析图 [英] Linear discriminant analysis plot

查看:48
本文介绍了线性判别分析图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将样本 ID(行号)作为标签添加到此 LDA 图中的每个点?

How can I add the sample ID (row number) as labels to each point in this LDA plot?

library(MASS)
ldaobject <- lda(Species~., data=iris)
plot(ldaobject, panel = function(x, y, ...) points(x, y, ...),
     col = as.integer(iris$Species), pch = 20)

推荐答案

可以在面板功能中使用text:

You can use text in the panel function:

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)

这篇关于线性判别分析图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆