如何解决在fviz_pca_biplot中为var和ind指定不同的点形
是否可以通过R包FactoExtra在fviz_pca_biplot()中为变量指定形状?
例如,我有以下代码:
data("iris")
PCA.iris <- prcomp(iris[,-5],scale=TRUE)
BiPlot<- fviz_pca_biplot(PCA.iris,geom = c("point","text"),geom.var = c("point",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)
但是它使 var 和 ind 的形状相同,我希望 var 的形状不同(形状15 )。当geom.var = c(“ point”,“ text”)设置为point时,“ pointshape”参数似乎适用于 var 和 ind 。
我已经尝试过使用scale_shape_manual():
BiPlot+
scale_shape_manual(values=15)
但它并不适用,我猜这是由于geom中使用geom_point的“点”,我无法指定要应用的巫婆点,但这只是一个疯狂的猜测。
是否可以将 var 和 ind 的pointshape设置为不同的值,然后怎么做?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。