Is there any way of specifying shape for variables in fviz_pca_biplot()
from R package FactoExtra?
For example I have the following code:
data("iris")
PCA.iris <- prcomp(iris[ , -5], scale=TRUE)
BiPlot<- fviz_pca_biplot(PCA.iris,
geom = c("point", "text"),
geom.var = c("point", "text"),
palette="ucscgb",
label="var",
col.ind=iris$Species,
invisible="quali",
pointshape = 19, pointsize = 3) +
labs(colour= "Species" )+
theme_gray() +
theme(plot.title = element_text(hjust = 0.5,size = 20, face = "bold"),
legend.title = element_text(size = 12),
legend.text = element_text(size = 8),
legend.key.size = unit(0.5,"line") )+
guides(shape = guide_legend(override.aes = list(size = 4)),
color = guide_legend(override.aes = list(size = 4)) )
print(BiPlot)
but it makes the shape for both var and ind the same, I would like the shape for var to be different (shape 15). The argument "pointshape" seems to apply to both var and ind when geom.var = c("point", "text") is set to point.
I have tried using scale_shape_manual()
:
BiPlot+
scale_shape_manual(values=15)
but it does not apply, I am guessing that this is due to "point" in geom uses geom_point and I can not specify to which point I want to apply it but this is just a wild guess.
Is it possible to set pointshape for var and ind to different values and how is it done then?