This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to match ellipse and point color in PCA plot (fviz_pca_biplot)?

Hello everyone,

I am performing a biplot from a PCA analysis and I am having trouble changing the color of the dots representing the samples to match it with the ellipse color and also matching them with the shapes for each sample.

I am using the following code once i get the PCA data:

fviz_pca_biplot(lipids.pca, col.var="black", label="all", labelsize=3, 
            geom.ind="point", pointsize=2, repel=F,
            col.ind=c(rep("Hc",6), rep("Ht",6), 
                      rep("Mc",6), rep("Mt",6), 
                      rep("Cc",6), rep("Ct",6), 
                      rep("Mbc",6), rep("Mbt",6)), 
            addEllipses=TRUE, ellipse.type="confidence", ellipse.alpha=0.3, 
            title="Lipidomics PCA")+ geom_point()+scale_shape_manual(values=seq(3:10))+ scale_color_manual(values=c("#800000", "#E69F00", "#66CDAA", "#5F9EA0", "#56B4E9", "#00008B", "#0000CD", "#FF1493"))

And getting something like this for each group of samples (see examples of 2 out of 8 groups).

PCA representation example 1 enter image description here

As you can see in the first image, point color and ellipse color don't match. In the second image point color don't match the ellipse color and geometry is both represented with triangles and dots...

How can I get the ellipse and the point colors matched and the geometry fixed? I think some argument may be missing, but I can't find the problem.

Many thanks if you can help!

ellipse biplot fviz_pca_biplot pca geometry

0 answers

No answers yet.

Log in to answer this question.