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

▼魔方 西西 提交于 2019-11-30 13:03:26

问题


I am using ggplot2 on ubuntu 12.04. By default my x11 type is set to Xlib. So when I use a smoother in qplot, I get an error like:

"semi-transparency is not supported on this device: reported only once per page".

However, if I call x11(type="cairo"), everything works fine.

How do I get cairo as the default backend for x11?


回答1:


Define another function 'x11' which sets the proper type:

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



回答2:


To make this permanent, you could add the following lines to your ~/.Rprofile file:

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


来源:https://stackoverflow.com/questions/10777008/how-to-set-cairo-as-default-backend-for-x11-in-r

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!