Skip to content
Prev 38646 / 63424 Next

postscript failure manifests in plot.TukeyHSD

Jari Oksanen <jari.oksanen <at> oulu.fi> writes:
I must really be avoiding work today ...

  I can diagnose this (I think) but don't know the best way to 
solve it.

  At this point, line widths on PDF devices were allowed to be <1.

==========
r52180 | murrell | 2010-06-02 23:20:33 -0400 (Wed, 02 Jun 2010) | 1 line
Changed paths:
   M /trunk/NEWS
   M /trunk/src/library/grDevices/src/devPS.c

allow lwd less than 1 on PDF device
==========

  The behavior of PDF devices (by experiment) is to draw a 0-width
line as 1 pixel wide, at whatever resolution is currently being
rendered.  On the other hand, 0-width lines appear to break PostScript.
(with the Linux viewer 'evince' I get warnings about "rangecheck -15"
when trying to view such a file).

  plot.TukeyHSD  contains the lines

abline(h = yvals, lty = 1, lwd = 0, col = "lightgray")
abline(v = 0, lty = 2, lwd = 0, ...)

  which are presumably meant to render minimum-width lines.

  I don't know whether it makes more sense to (1) change plot.TukeyHSD
to use positive widths (although that may not help: I tried setting
lwd=1e-5 and got the line widths rounded to 0 in the PostScript file);
(2) change the postscript driver to *not* allow line widths < 1 (i.e.,
distinguish between PS and PDF and revert to the pre-r52180 behaviour
for PS only).  

  On reflection #2 seems to make more sense, but digging through devPS.c
it's not immediately obvious to me where/how in SetLineStyle or
PostScriptSetLineTexture one can tell whether the current driver
is PS or PDF ...