[英]R: color first 100 observations different than second 100 observations
I have 200 observations with 6 features each, and I am trying to color the first 100 observations a different color than the second 100 observations.我有 200 个观测值,每个观测值有 6 个特征,我试图将前 100 个观测值着色为与后 100 个观测值不同的颜色。 This is for principal component analysis.
这是用于主成分分析。 I have to insert some code with "col" inside my code but I do not know how to do this.
我必须在我的代码中插入一些带有“col”的代码,但我不知道该怎么做。 Can anyone help?
任何人都可以帮忙吗? Thanks!
谢谢!
biplot(pr.out,scale=0,col=?)
The above comments are good advice, but the answer to your question is that you cannot use more than one color for the observations in the version of biplot
in the stats
package (see manual pages ?biplot.prcomp
and ?biplot.default
).上述评论是很好的建议,但您的问题的答案是,您不能在
stats
package 的biplot
版本中使用一种以上的颜色进行观察(请参阅手册页?biplot.prcomp
和?biplot.default
)。 You can use different symbols however:但是,您可以使用不同的符号:
PCA <- prcomp(USArrests, scale = TRUE)
sym <- c(rep("x", 25), rep("o", 25))
biplot(PCA, scale=0, xlabs=sym)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.