[R] Remove "gray grid" from levelplot

Martin Sandiford ms at mcdev.com.au
Mon Mar 6 11:11:13 CET 2006

Hi Jan,

The patch requires a recompile of R.  As I understand it,
this is a fairly painful experience.  I haven't done it

I find that using the pdf() function to open a pdf device
produces better quality output when printing than saving
a quartz device from the menu.

It appears that the postscript() and pdf() devices use
sub-pixel rendering as well, as output shows evidence of gray
lines on low resolution devices, however, for me, this isn't
evident on a printer at 1200x1200dpi.

My guess would be that, in general, levelplot is not a great
function to use if the box size approaches the resolution of
the underlying device.  The first example in help(levelplot)
exhibits severe moire patterns on an approx 740x740 quartz or
x11() device.  When the output from the postscript device is
printed out, it looks more or less as expected.

If there are more boxes in the levelplot than pixels on the
device you are plotting to, then in effect you are asking
the display device to do the averaging of the excess
boxes for devices that support sub-pixel rendering.

I'm still not 100% sure what it is that you are trying to do,
but I'm guessing that it boils down to levelplot not being
designed to plot analytic functions.


P.S. To me, the png() device does not appear to do sub-pixel
rendering.  The postscript() and pdf() devices do.

On 06/03/2006, at 1:43 AM, Jan Marius Hofert wrote:

> Hi,
> I am using a Mac (Powerbook G4, Mac Os X 10.4) and this seems to be  
> the problem, but I have absolutely no idea how to use the "patch"  
> mentioned on  
> https://stat.ethz.ch/pipermail/r-sig-mac/attachments/20060214/ 
> 0b3e99c2/attachment.pl
> I would also like to create *.ps files so this does not seem to be the  
> appropriate approach. I can also use x11 as trellis.device which fixes  
> the color-problem, but the lines are plotted in bad quality then.  
> Also, I can not save the graph then, when plotted with x11. All other  
> devices (png, pdf) have the same problem with the fine gray lines....
> so the R version for the mac must be the problem, but I have no idea  
> how to fix that. It would not matter if the plots via the quartz  
> device (on the screen) would be bad as long as the postscript file  
> comes out perfect.
> Thanks again and any more comments/hints are appreciated
> marius
> On 05.03.2006, at 13:19, Martin Sandiford wrote:
>> I don't know what kind of computer you are using.
>> If you are on a Mac, then this might be relevant:
>> https://stat.ethz.ch/pipermail/r-sig-mac/2006-February/002679.html
>> (Need to click through to the actual message.)
>> Martin
>> On 05/03/2006, at 2:52 AM, Jan Marius Hofert wrote:
>>> Hi,
>>> If I use the levelplot function of the lattice library, I always see
>>> small "squares" in the plot. They indicate the region for which the
>>> same color is used. If you have a levelplot of a function which is
>>> evaluated at 25x25 equally-spaced points you obtain 26 squares in x
>>> and 26 squares in y direction. That does not bother too much (but
>>> still bothers somehow...), but if you want to plot a function which
>>> is evaluated at 1000x1000 equally-spaced points, then the "thickness"
>>> of this gray grid cause the grid lines to hit each other so there is
>>> no space for the color in the square anymore (since the "squares" are
>>> actually not visible anymore)... this might change the color of the
>>> whole levelplot!. (I tried it with the plot of f(x,y)=max(x+y-1,0)
>>> for x,y in the unit interval, i.e. the Lower Frechet copula). So my
>>> question is, if it is possible to remove this gray "grid" form the
>>> levelplot graph?
>>> Thanks in advance
>>> marius
>>> ______________________________________________
>>> R-help at stat.math.ethz.ch mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide!  
>>> http://www.R-project.org/posting-guide.html

More information about the R-help mailing list