>If you want to specify the colour of each individual point manually use the col.ind option:
>
>plot(res.pca, axes=c(1,2), col.ind=c("black","black","black","red","red","red","red"))
Hi,
Unfortunately, that doesn't work
> library(FactoMineR)
> mydata <- read.csv('test.csv', header=T,row.names=1)
> res.pca = PCA(mydata[,1:4], scale.unit=TRUE, graph=F)
> head(mydata)
V1 V2 V3 V4
P1 73.6 0.7 74.6 3.1
P2 75.2 0.7 75.8 2.8
P3 6.5 0.0 7.3 2.5
P4 41.4 0.3 39.2 8.9
P5 5.4 0.1 18.2 1.1
P6 18.8 0.3 30.3 7.3
> plot(res.pca,axes=c(1,2),col.ind=c("black","black","black","red","red","red"))
Error: Aesthetics must be either length 1 or the same as the data (6): colour
Run `rlang::last_error()` to see where the error occurred.
> rlang::last_error()
<error/rlang_error>
Aesthetics must be either length 1 or the same as the data (6): colour
Backtrace:
1. (function (x, ...) ...
2. ggplot2:::print.ggplot(x)
4. ggplot2:::ggplot_build.ggplot(x)
5. ggplot2:::by_layer(function(l, d) l$compute_geom_2(d))
6. ggplot2:::f(l = layers[[i]], d = data[[i]])
7. l$compute_geom_2(d)
8. ggplot2:::f(..., self = self)
9. self$geom$use_defaults(data, self$aes_params, modifiers)
There are P1~P6 and six colors in the vector. So, I wonder why it says
they have different sizes.
I also thought ath maybe it considers the first row which are V1~V4, I
created 7 colors as you mentioned.
> plot(res.pca,axes=c(1,2),col.ind=c("black","black","black","red","red","red","red"))
Error: Aesthetics must be either length 1 or the same as the data (6): colour
Run `rlang::last_error()` to see where the error occurred.
Regards,
Mahmood