[R-SIG-Mac] [R] Sweave, lty = 3 line incorect in pdf output

Ken Knoblauch ken.knoblauch at inserm.fr
Fri Feb 12 22:37:18 CET 2010


Ken Knoblauch <ken.knoblauch <at> inserm.fr> writes:
> First, I want to thank everybody who responded for their
> helpful comments and suggestions, though the problem is
> still unresolved and if anyone has any additional ideas,
> I would be grateful.  Second, if I can test your patience
> just a bit more, I have found an additional clue that
> perhaps will help solve the mystery of the missing dotted
> lines (on my system, apparently).
> 
> I tried on another Leopard system (64 bit R) with the same result, and then
> on a system running Tiger (all with a version of R 2.10.1 patched),
> The dotted lines appeared on Tiger.  I transferred the Tiger generated
> file to my Leopard Mac and the dotted line appears on the viewer,
> here, as well.  So, I investigated how the files might differ
> and the only thing that I can find is that the Tiger generated
> version contains the lines
> 
> 1 J
> 1 j
> 
> whereas, in the Leopard generated version, I only see
> 
> 1 j
> 
> If I add a line of 1 J to the Leopard generated file, after line 35,
> the dotted lines do appear in my viewer.
> 
> I don't know what these commands do in pdf (I don't speak pdf).
> Would anyone have an idea what could have happened that my pdf()
> command does not produce them and most importantly, any ideas on
> how to fix it?

> >> -- 
> >> Ken Knoblauch
> >> Inserm U846
> >> Stem-cell and Brain Research Institute
> >> Department of Integrative Neurosciences
> >> 18 avenue du Doyen Lépine
> >> 69500 Bron
> >> France
> >> tel: +33 (0)4 72 91 34 77
> >> fax: +33 (0)4 72 91 34 61
> >> portable: +33 (0)6 84 10 64 10
> >> http://www.sbri.fr/members/kenneth-knoblauch.html

Some additional search in the pdf reference manual and I found that
1 j refers to linejoin choice (ljoin = 1 in par)
1 J to line end (lend = 1 in par)

>From this I tried,


pdf(file = "testPP.pdf")
par(lend = 1) # the default is 0 according to ?par
x <- 1:10
plot(x, type = "l", lty = 3, lwd = 3)
lines(x, 0.5 * x)
dev.off()

which produces the correct dotted line (in my viewer)...

I can add par(lend = 1) throughout my Sweave document, I guess.
If anybody has any further suggestions, or how to fix this globally,
I'm interested in hearing from you.  Thanks.

Ken



More information about the R-SIG-Mac mailing list