[Rd] Use cairo fallback resolution greater than 72dpi in cairo_pdf and cairo_ps in grDevices

Tom Wenseleers Tom.Wenseleers at bio.kuleuven.be
Tue Jul 14 13:03:57 CEST 2015


Dear all,
In grDevices R functions cairo_pdf and cairo_ps it is mentioned that when transparency (alpha channels) are used in vector output, it will rasterize the PDF or postscript exported graph at a resolution of 72 dpi : https://stat.ethz.ch/R-manual/R-devel/library/grDevices/html/cairo.html

You can see the problem if you try

library(ggplot2)
cairo_ps(file = "test.eps",onefile = FALSE)
qplot(Sepal.Length, Petal.Length, data = iris, color = Species, size = Petal.Width, alpha = I(0.7))
dev.off()

as in the output (here zoomed in) the plot symbols are heavily pixelated then, showing it is only using 72 dpi.

I was wondering how the fallback resolution could be increased to 600 dpi? In library(RGtk2) there is a command cairoSurfaceSetFallbackResolution, which I think is what is relevant here, but I would not know how to make grDevices use that parameter. Any thoughts?

Using postscript() btw also doesn't work, since that doesn't support transparency, and returns the error "semi-transparency is not supported on this device: reported only once per page".


I know I can use svg or pdf instead and that this would solve the problem, but problem is the journal (PloS) I would like to submit to only accepts EPS. So is there any solution to increase the quality in EPS, without having to rasterize everything to PNG?

best regards,
Tom Wenseleers






	[[alternative HTML version deleted]]



More information about the R-devel mailing list