kassambara / factoextra

Extract and Visualize the Results of Multivariate Data Analyses
http://www.sthda.com/english/rpkgs/factoextra
358 stars 103 forks source link

in fviz_pca_indiv, use of fill.ind or habillage changes size of points #146

Open drelo opened 2 years ago

drelo commented 2 years ago

Dear all,

I noticed there is a similar issue here #42 and #25, but now I am trying to plot fviz_pca_indiv and the points appear with different size even supplying fill.indas suggested as possible solution in previous issues.

moreBact contains 4, columns with metadata and rows with abundance. All the visualizations look fine but the points seems to have different size and I can't control this even passing the pointsize parameter.

more <- read_delim("more.tsv", delim = "\t", escape_double = FALSE, trim_ws = TRUE)
moreCol  <-  more %>% column_to_rownames("sample")
moreFact <- moreCol %>% mutate(across(c(age,response,diagnose,sex), factor))

First the PCA object

pcaMore <- PCA(moreFact[,-c(1:4)], graph = FALSE)

I modified the columns so I don't have to use as.factor in the future. Neither of this ways worked the first one returns no distinct color between point and different size and the second one returns images with distinct colors per group but different sizes among points.

fviz_pca_ind(pcaMore,
             label = "ind", axes = c(2, 3),
             geom = c("point", "text"), fill.ind  = moreFact$diagnose, 
             addEllipses = FALSE, pointsize = 4, repel= FALSE)
fviz_pca_ind(pcaMore,
             label = "ind", axes = c(2, 3),
             geom = c("point", "text"), habillage  = moreFact$diagnose, 
             addEllipses = FALSE, pointsize = 4, repel= FALSE)

Here is the dataset

Thanks in advance for all your time and help

Andrés

drelo commented 2 years ago

Dear @kassambara is there any trick I can do to fix this? Any help would be appreciated as I commented before I view the issues #42 and #25 but I couldn't see how to adapt the code above.

Andrés