简体   繁体   English

R:颜色前 100 次观察不同于后 100 次观察

[英]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.

相关问题 R 中已排序多列的最高和最低 100 个观察值 - Highest and lowest 100 observations for sorted multiple columns in R 如何使用 ODBC package 从 SQL 服务器读取大表(>100 列(变量)和 100,000 个观察值)到 R - How to read a large table (>100 columns (variables) and 100,000 observations) from SQL Server into R using ODBC package 我正在尝试从总共100个观察中形成7组随机观察。 应该使用所有观察结果 - I am trying to form 7 groups of random number of observations from a total of 100 observations. All observations should be used R图中配色方案的最大观测值 - R maximum observations for color scheme in a plot 删除相邻列不等于 100 的匹配观测值 - Removing matching observations where their adjacent column does not equal to 100 summary() 默认情况下是否只返回 100 个观察值,我可以增加它吗? - Does summary() by default only return 100 observations and can I increase this? R - 协变量多于观测值的贝叶斯树 - R - Bayes Trees with more covariates than observations 删除少于3个观察值的ar表中的行 - Deleting rows in a r table with less than 3 observations 在 R 中计数大于 20 的观察值 - counting observations greater than 20 in R 为R中的每个级别选择前80个观测值 - Select first 80 observations for each level in R
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM