[R] undesired grid in ps/eps outputs generated by filled.contour or image

Marc Schwartz marc_schwartz at comcast.net
Fri Feb 6 23:33:23 CET 2009


> On Fri, 6 Feb 2009, Marc Schwartz wrote:
> 
>> on 02/06/2009 01:32 PM Rachel Albrecht wrote:
>>> Hi!
>>>
>>> Whenever I save a graphic in ps/eps format generated by
>>> filled.contour or image, an undesired grid is added to it (not
>>> visible on the X11 screen). For example:
>>>
>>> postscript("volcano.eps")
>>> filled.contour(volcano,col=gray(seq(0,1,,50)),levels=seq(min(volcano),max(volcano),,50))
>>>
>>> dev.off()
>>>
>>> Any ideia how to eliminate this grid?
>>>
>>> Thanks,
>>> Rachel
>>
>> I can confirm the problem, running:
>>
>>  R version 2.8.1 Patched (2009-01-24 r47726)
>>
>> on Fedora 10.
>>
>> The problem is actually worse if using the pdf() device, with additional
>> artifacts present.
>>
>> There was a posting about this back in 2003:
>>
>>  https://stat.ethz.ch/pipermail/r-help/2003-August/037348.html
>>
>> with no replies. There is a bug report here from 2004:
>>
>>  http://bugs.r-project.org/cgi-bin/R/Graphics?id=6763
>>
>> that seems to be related. So it seems the issue has been around for a
>> while.
>>
>> I tried increasing the granularity of the color scale, though without
>> any benefit.
>>
>> Will have to defer to the graphics device wizaRds on this one.
>>
>> Marc Schwartz

Thanks to Prof. Ripley for pointing out my error here and my apologies
for leaving the impression that this was related to the R graphics devices.

As it turns out, this is uniquely a PS/PDF viewer issue related to the
use of anti-aliasing in the viewer.

I had initially used Evince, which is the default PS/PDF viewer in GNOME
(Linux desktop environment). In Evince, there does not appear to be an
option to disable anti-aliasing, either within the application or in
GConf, which is another application to configure GNOME application
related settings.

When using Adobe's Acrobat Reader for the PDF file, if I go into Edit ->
Preferences -> Page Display and disable "Smooth line art", the lines do
indeed go away. There are two other anti-aliasing settings there,
"Smooth Text" and "Smooth images", which do not appear to have any
effect here.

I installed gsview, which is no longer part of the default Ghostscript
installation for Fedora (it is now part of the new RPMFusion repo).

In gsview, if I go into Media -> Display Settings and change "Graphics
Alpha" from 4 bits to 1 bit (to disable anti-aliasing), the image
displays properly. The "Text Alpha" setting does not appear to affect this.

So, to reiterate, this is a PS/PDF viewer application problem and not an
R graphics device issue. If you are unable to disable anti-aliasing in
the viewer that you are using, try another application.

Regards,

Marc




More information about the R-help mailing list