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

2

16

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?

Scammony answered 27/5, 2012 at 20:25 Comment(2)
See: options('device')Tilbury
I get the same behavior, and I think it must be a bug in x11. The documentation for the type parameter of x11 says "The default is ‘"cairo"’ where available except on Mac OS X, otherwise ‘"Xlib"’. Clearly cairo is available, so it should be the default.Schmooze
D
5

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

x11 = function (...) grDevices::x11(...,type='cairo')
Dalhousie answered 28/5, 2012 at 16:30 Comment(0)
C
13

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')
Clem answered 9/5, 2013 at 14:23 Comment(0)
D
5

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

x11 = function (...) grDevices::x11(...,type='cairo')
Dalhousie answered 28/5, 2012 at 16:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.