我想让图例消失。上面是我在R中对虹膜数据集所做的一个例子,我在fviz_pca_ind()的文档中找不到一个变量来省略图例。
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")
根据 文件 fviz_pca的。
输出类是 gg
或 ggplot
. 因此,下面的代码应该对你有用。
pca_n.macros_plot + theme(legend.position = "none")