takeITeasy
takeITeasy

Reputation: 360

How to plot with fviz_pca_ind() without showing the legend?

I want the legend to disappear. Above is an example of what I did with the iris dataset in R. I could not find a variable in the documentation of fviz_pca_ind() to omit the legend.

library(factoextra)
library(FactoMineR)
pca_iris <- PCA(iris[ ,-5])
iris$species <- as.factor(iris$Species)
pca_n.macros_plot <- fviz_pca_ind(pca_iris, 
             pointshape = 21,habillage = iris$species,
             palette = "jco",label="none",
             geom.ind = c("point"),geom = c("point"),
             title="PCA iris")

Upvotes: 2

Views: 4291

Answers (1)

Neel Kamal
Neel Kamal

Reputation: 1076

As per the documentation of fviz_pca,

the output class is gg or ggplot. Hence, below code should work for you.

pca_n.macros_plot + theme(legend.position = "none")

Upvotes: 2

Related Questions