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

Prof Brian Ripley ripley at stats.ox.ac.uk
Sat Jul 18 10:09:09 CEST 2015


The 'at a minimum' information requested by the posting guide is missing.

According to their documentation the cairo default fallback resolution 
is now 300dpi, and when I run your example on Fedora 21 that is what the 
emitted postscript says it is.

You can easily alter the R code to set it to something different: see 
http://cairographics.org/manual/cairo-cairo-surface-t.html for the call 
you would need to add.

However, I would suggest that you generate a bitmap directly and use 
that, as PostScript does not support semi-transparency.

On 14/07/2015 12:03, Tom Wenseleers wrote:
> 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]]
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Emeritus Professor of Applied Statistics, University of Oxford
1 South Parks Road, Oxford OX1 3TG, UK



More information about the R-devel mailing list