[R] pdf: plotting very small points

Duncan Murdoch murdoch.duncan at gmail.com
Wed Mar 5 18:24:10 CET 2014


On 05/03/2014 8:34 AM, Rebecca.Hiller at meteoswiss.ch wrote:
> Dear all,
>
> Ghostscript (version 9.05) cannot open pdfs produced with R (version 3.0.2) that contain very small points in plots. Other pdf readers (evince, AcrobatReader) are able to open the file. If setting cex=0, the pdf is readable again:
>
> # does open with gs
> pdf("cex_small.pdf")
> plot(1,1,cex=10^-3)
> dev.off()
>
> # does not open with gs
> pdf("cex_verysmall.pdf")
> plot(1,1,cex=10^-4)
> dev.off()
>
> # does open with gs
> pdf("cex_zero.pdf")
> plot(1,1,cex=0)
> dev.off()
>
> For sure, I can check the value assigned to cex before plotting. However, this is rather inconvenient. I need to convert the graphs using convert to other file formats, hence simply using another pdf readers is not an option either. Any suggestions?

 From your description, it sounds like a Ghostscript bug, so you might 
want to report it to them.  But a simple workaround is to just round 
your cex values, e.g. use round(cex, 2) and 0.001 will become 0.

Duncan Murdoch




More information about the R-help mailing list