简体   繁体   English

如何将cairo设置为R中x11()的默认后端?

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

I am using ggplot2 on ubuntu 12.04. 我在ubuntu 12.04上使用ggplot2。 By default my x11 type is set to Xlib. 默认情况下,我的x11类型设置为Xlib。 So when I use a smoother in qplot, I get an error like: 因此,当我在qplot中使用更平滑时,我得到一个错误,如:

"semi-transparency is not supported on this device: reported only once per page". “此设备不支持半透明:每页仅报告一次”。

However, if I call x11(type="cairo"), everything works fine. 但是,如果我调用x11(type =“cairo”),一切正常。

How do I get cairo as the default backend for x11? 如何将cairo作为x11的默认后端?

To make this permanent, you could add the following lines to your ~/.Rprofile file: 要使此永久化,您可以将以下行添加到〜/ .Rprofile文件中:

setHook(packageEvent("grDevices", "onLoad"),
function(...) grDevices::X11.options(type='cairo'))
options(device='x11')

定义另一个设置正确类型的函数'x11':

x11 = function (...) grDevices::x11(...,type='cairo')

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

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