简体   繁体   English

R ggbiplot美学

[英]R ggbiplot aesthetics

is it possible to change the thickness of the ellipses (incl circle) in ggbiplot? 可以更改ggbiplot中椭圆(包括圆)的厚度吗? The arguments don't seem to have that option. 参数似乎没有该选项。 Is there another way around it? 还有其他解决方法吗? So far I've dealt with this issue by making my data points more transparent. 到目前为止,我已经通过使数据点更加透明来解决此问题。

I assumed you got a recent version of ggbiplot from github (19 Jun 2015 https://github.com/vqv/ggbiplot ). 我假设您从github(2015年6月19日https://github.com/vqv/ggbiplot )获得了ggbiplot的最新版本。 In this one, the circle thickness is hard-coded, but you can modify the code easily. 在这种方法中,圆的粗细是硬编码的,但是您可以轻松地修改编码。 The parameter in question is set here (around line 86 in the definition of ggbiplot() ): 此处设置了相关参数(在ggbiplot()定义的第86行附近):

if (circle) {
      theta <- c(seq(-pi, pi, length = 50), seq(pi, -pi, 
                                                length = 50))
      circle <- data.frame(xvar = r * cos(theta), yvar = r * 
                             sin(theta))
      g <- g + geom_path(data = circle, color = muted("white"), 
                         size = 1/2, # <= MODIFY HERE
      alpha = 1/3)
        }

Copying the ggbiplot code into a new function and changing it works, but the change in line 87 only works if var.axes = TRUE , which is the default. ggbiplot代码复制到新函数中并对其进行更改即可,但是仅在var.axes = TRUE (默认情况下),行87中的更改才有效。 If you set var.axes = FALSE then you need to add a size parameter to the call in line 124. Something like g <- g + geom_path(data = ell, aes(color = groups, group = groups),size=2) . 如果设置var.axes = FALSE则需要在第124行的调用中添加一个size参数。类似g <- g + geom_path(data = ell, aes(color = groups, group = groups),size=2)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM