【问题标题】:Linear discriminant analysis plot线性判别分析图
【发布时间】: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)

【问题讨论】:

    标签: r plot


    【解决方案1】:

    您可以在面板功能中使用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)
    

    【讨论】:

      猜你喜欢
      • 2013-06-19
      • 2018-07-08
      • 2022-06-22
      • 2020-02-03
      • 2016-07-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-08-14
      相关资源
      最近更新 更多