R-3.3.2中Cairo半透明问题

3
我有一个与R半透明度相关的问题(R版本3.3.2)。 当我尝试执行以下操作时,会出现此错误:

ggplot(iris, aes(x = factor(Species), y = Sepal.Length, fill = Species)) +
+   geom_boxplot(alpha = 0.4)

Warning messages: 
1: In grDevices::x11(..., type = "cairo") :
  cairo-based types are not supported on this build - using "Xlib" 
2: In grid.Call.graphics(L_polygon, x$x, x$y, index) : 
  semi-transparency is not supported on this device: reported only once per page

我尝试了 http://tinyheero.github.io/2015/09/15/semi-transparency-r.html如何将cairo设置为R中x11()的默认后端? 在RStudio中实现半透明 如何在ggplot2中保留透明度? 但我仍然遇到相同的错误,我修改了.Rprofile,重新启动但没有用。
我不知道什么样的输出对于帮助我解决问题有用。
也许:
options('device')
$device
[1] "x11"

感谢您提供的任何线索,如果您想查看其他输出,请告诉我。
编辑1:
>sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.5 LTS

locale:
 [1] LC_CTYPE=fr_FR.UTF-8       LC_NUMERIC=C               LC_TIME=fr_FR.UTF-8        LC_COLLATE=fr_FR.UTF-8    
 [5] LC_MONETARY=fr_FR.UTF-8    LC_MESSAGES=fr_FR.UTF-8    LC_PAPER=fr_FR.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=fr_FR.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] Cairo_1.5-9


>capabilities("cairo")
    cairo 
    FALSE 

那是哪个操作系统?相关链接:http://r.789695.n4.nabble.com/Error-in-svg-cairo-based-devices-are-not-supported-on-this-build-td3535907.html - tonytonov
谢谢您的回答,我正在使用BioLinux / Ubuntu 14.04 LTS。 - Corend
请发布您的 sessionInfo()?X11 的文档条目指出:“如果系统在没有支持 cairographics 的情况下编译,则只有 [Xlib] 可用。” 所以也许您缺少系统库?capabilities("cairo") 是什么?可能相关:https://dev59.com/3mrWa4cB1Zd3GeqP_Xh9 - tonytonov
我刚刚编辑了我的帖子,再次感谢您 :-) - Corend
1个回答

3

我终于找到了一种让它工作的方法:

我卸载了R,使用./configure --with-cairo重新安装了它。

现在一切都正常了,我拥有了:

> capabilities("cairo")
cairo 
 TRUE 

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接