[R] pdf: plotting very small points

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Mar 7 16:00:24 CET 2014


On 05/03/2014 17:24, Duncan Murdoch wrote:
> 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.

Or a different interpretation of the PDF standard.

Why anyone would want an object of size less than 0.01 bp (which is 
where the issue arises) escapes me.

I'll probably do the rounding internally for safety.


>
> Duncan Murdoch
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list