[R] Remove "gray grid" from levelplot

François Pinard pinard at iro.umontreal.ca
Tue Mar 7 00:43:07 CET 2006


[Brian Ripley]
>On Mon, 6 Mar 2006, Martin Sandiford wrote:

>[...]

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

>What could you possibly mean by that?

I would think the original poster refers to aliasing issues.

>The png device writes on a bitmap.  It outputs a rectangular grid of 
>either pre-defined colour indices or RGB values.  There is nothing in 
>the PNG standard to allow anything finer.

Granted.  Yet, there are nuances.  Anti-aliasing techniques may be 
applied to bit-mapped images like PNGs, and a carefully computed alpha 
channel could be included in the PNG as a way to acknowledge sub-pixel 
rendering matters.

If the background of the generated image is opaque instead of 
transparent, the graphics and the background might be combined at PNG 
generation, swallowing what would have been an alpha channel and so, 
sparing the need of including any in the generated PNG.

However, on this Linux system, if I understood correctly, R goes through 
X11 for generating PNGs, and so, does no better than X11 itself (at 
least as currently driven by R) in the area of anti-aliasing.

Anti-aliasing libraries exist (which I never really studied or used 
myself) that could likely provide better PNG quality.  Did some decision 
has been reached among developers on this topic?  I would guess, without 
really knowing, that developers favor vector-to-raster rendering to be 
done outside R, whenever quality is required.

Using an anti-aliasing library for higher output quality within R would 
mean, besides the obvious trouble of selecting one of those libraries 
and programming the interface, adding yet another dependency at 
R build-time (likely autoconfigured, of course), and an observable 
slowdown for graphics which are more heavily loaded, especially in 
interactive mode.  For one, I do not need more than draft quality so far 
when using R interactively for plots.  Maybe some "draft", "quality" or 
"aa" flag is added to control anti-aliasing behaviour? (I know that 
"quality" is already used to mean something else for JPEG images).

                      Just a few thoughts.  Keep happy, all!

-- 
François Pinard   http://pinard.progiciels-bpi.ca




More information about the R-help mailing list