This is a test version of Biostars. For the public version, visit https://www.biostars.org.
I would like to delete a legend in PCA in R

I used script below to draw a PCA. In order to increase the points, I added size=0 in geom_point(). But in the figure, there is a legend size. How can I remove the legend? Thanks.

ggplot(degree121, aes(PC1, PC2, col=Classification, fill=Classification, group=Classification))+ stat_ellipse(geom="polygon", alpha=0.1) + geom_point(aes(shape=Classification, color=Classification, size=0))+ theme_bw()+ scale_color_manual(values = c("red","green","blue"))

r

1 answer

Add + theme(legend.position = "none").

Questions for common packages like ggplot can almost always be answered via Google rather than posting here.

Log in to answer this question.