r - 开罗的 R-3.3.2 问题中的半透明

标签 r ggplot2 x11 cairo

我对 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 ,

How to set cairo as default backend for x11() in R?

Semi-transparency in RStudio

How do I preserve transparency in 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 

最佳答案

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

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

现在一切正常,我有:

> capabilities("cairo")
cairo 
 TRUE 

关于r - 开罗的 R-3.3.2 问题中的半透明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46727421/

相关文章:

node.js - NPM 在通过 apt 安装时需要 x11

opengl - glXCreateContext 神奇地映射窗口

r - 为什么这段代码在 R 控制台中工作,而不是作为 R 包的一部分?

r - 将 dcast.data.table 与日期值和聚合一起使用

R:在列表中保存 ggplot2 图

r - 在 R 中的绘图网格中添加边框

r - 如何避免每次运行 R 程序时读入数据

R 中缺少日期的时间序列的滚动平均值

r - ggplot2: theme(legend.title) 忽略 vjust 和 hjust 参数

XGetWindowProperty 的窗口类型的正确大小