79224113

Date: 2024-11-25 17:57:59
Score: 3
Natty:
Report link

I have a similar problem with fviz. For PCA it doesn´t recognize the label neither the text for ggrepel, so you can't use it right away.

What you can do is create your own labels, for that you omit the labels text and then you call the text from another database, for example:

    dat1 <- facto_summarize(PCA.Res01, element = "ind", axes = c(1, 2), result = c("coord", "contrib", "cos2"))
    
    fviz_pca_biplot(PCA.Res01, # Individuals
                                        geom.ind = "point",
                                        geom.var = "arrow",
                                        fill.ind = DataPCA01$CitysNumb,
                                        pointshape = 21, pointsize = 1,
                                        palette = "ucscgb",
                                        repel = TRUE,
                                        addEllipses = TRUE,
                                        ellipse.level=0.95,
                                        labelsize = 6, # Variables
                                        col.var = "contrib",
                                        gradient.cols = c("blue", "red", "black"), ggtheme = theme_minimal()) +
  geom_text_repel(data = dat1, 
                  aes(x=Dim.1,y=Dim.2, label = rownames(dat1)), 
                  size = 5,
                  box.padding = 1,
                  nudge_y = 3,
                  nudge_x = 2)
Reasons:
  • Blacklisted phrase (1): I have a similar problem
  • Long answer (-1):
  • Has code block (-0.5):
  • Me too answer (2.5): I have a similar problem
  • Low reputation (1):
Posted by: Gastón Sepúlveda Truan