我正在使用 ggbiplot() 并希望操纵数据点的颜色和形状以使它们对打印机更友好。目前我从 ggbiplot() 获得了默认的彩虹色。我曾尝试使用参数“+ scale_colour_discrete”和“+ scale_shape_manual”,但“groups=”参数 ggbiplot 似乎覆盖了这些。如果我消除“groups=”参数,则无法绘制椭圆。“+ 主题”参数工作得很好。我的代码如下。我知道我可以在常规 biplot() 函数中更轻松地操纵颜色/形状,但我喜欢 ggbiplot() 提供的置信区间椭圆。
g <- ggbiplot(size.pca, choices=1:2, obs.scale = 1, var.scale = 1,
groups=fieldnames, ellipse = TRUE,ellipse.prob=0.68, varname.size=4)
g <- g + scale_colour_discrete(name=" ") #only the name=" " part of this seems to work.
g <- g + scale_shape_manual(values=c(17,16,16,16,16,16), name= " ") #trying to indicate one population different from the rest, but it doesn't seem to do anything (no error either, just no change in the output).
g <- g + theme_bw() +theme(legend.direction = 'horizontal',
legend.position = 'top')
print(g)