简体   繁体   English

按组划分的 psych FA 双标图颜色

[英]psych FA biplot colour by group

I'm trying to use psych to perform factor analysis and create a biplot in which points are coloured by grouping variable.我正在尝试使用 psych 执行因子分析并创建一个双标图,其中点按分组变量着色。

I want the biplot to group by colour and only plot points not group labels.我希望双标图按颜色分组,只有 plot 点不分组标签。

Documentation suggests passing labels = NULL will plot points using character supplied by pch .文档建议使用pch提供的字符传递labels = NULL will plot points。 However, doing so reduces the plot to only the first group (setosa).但是,这样做会将 plot 减少到仅第一组 (setosa)。

Perhaps I am misunderstanding the group argument?也许我误解了group论点? Your help is appreciated.感谢您的帮助。
Example:例子:

library(psych)

data(iris)

iris_fa <- fa(iris[,-5],
              nfactors = 2)

biplot.psych(iris_fa,
             labels=iris[,5],
             choose = c(1,2),
             pch=16,
             group = iris[,5])

在此处输入图像描述

I

You specified pch with one value, but you need three.您用一个值指定了pch ,但您需要三个。 (Otherwise it's like saying 16, 0, 0.) So when you added labels , it ignored pch , and used that parameter. (否则就像说 16、0、0。)因此,当您添加labels时,它会忽略pch并使用该参数。

biplot.psych(iris_fa,
             # labels=iris[,5],
             # choose = c(1,2),
             pch= c(16, 16, 16),
             group = iris[,"Species"])

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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