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

Ken Knoblauch ken.knoblauch at inserm.fr
Fri Feb 12 19:22:53 CET 2010


I forgot to point out that the Tiger and Leopard generated
pdf's were attached to the previous mail for examination,
testing, etc. if anyone is still interested.  In any case,
thanks in advance.

Ken

Quoting Ken Knoblauch <ken.knoblauch at inserm.fr>:

> 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).
>
> Recall the minimal example,
>
> pdf(file = "test.pdf")
> x <- 1:10
> plot(x, type = "l", lty = 3, lwd = 3)
> lines(x, 0.5 * x)
> dev.off()
>
> And the issue is that I don't see the dotted line in my viewer.
> I do, however, if the file is created by
>
> quartz(file = "testQ.pdf", type = "pdf")
> x <- 1:10
> plot(x, type = "l", lty = 3, lwd = 3)
> lines(x, 0.5 * x)
> dev.off()
>
> but then the file generated is 72 Kb instead of 4Kb as with the pdf
> device.
>
> 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?
>
> Thank you, again, for your responses.
>
> Leopard sessionInfo
> sessionInfo()
> R version 2.10.1 Patched (2010-02-09 r51118)
> i386-apple-darwin9.8.0
>
> locale:
> [1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods
> [7] base
>
> best,
>
> Ken
>
> Quoting Thomas Lumley <tlumley at u.washington.edu>:
>
>> On Thu, 11 Feb 2010, Ken Knoblauch wrote:
>>
>>> Thanks.  By intended result, do you mean that the dotted line
>>> in the viewed pdf file from the short code appeared correctly?
>>> which would support the hypothesis that it is something specific
>>> to my computer/setup or that it appeared as I had intended
>>> the example to demonstrate? in which case, it is consistent
>>> with a problem with Leopard.
>>
>> It also worked correctly for me on Leopard (10.5.8).
>>
>>     -thomas
>>
>>
>>> Ken
>>>
>>> Quoting David Winsemius <dwinsemius at comcast.net>:
>>>
>>>>
>>>> On Feb 11, 2010, at 5:42 AM, Ken Knoblauch wrote:
>>>>
>>>>> Achim.
>>>>>
>>>>> Indeed, you are right.  That is where the problem is.
>>>>> Thanks for helping localize it a bit further.
>>>>> So, I should cc this to the r-sig-mac list.
>>>>>
>>>>> For the r-sig-mac list, here is the original post on the r-help
>>>>>
>>>>> https://www.stat.math.ethz.ch/pipermail/r-help/2010-February/227832.html
>>>>>
>>>>> The pdf() command (at least on my Mac :( )  appears to have
>>>>> a problem in displaying dotted lines (lty = 3).
>>>>> Short example,
>>>>>
>>>>> pdf(file = "test.pdf", height = 6, width = 6)
>>>>>
>>>>> x <- 1:10
>>>>> plot(x, type = "l", lty = 3, lwd = 3)
>>>>> lines(x, 0.5 * x, type = "l")
>>>>>
>>>>> dev.off()
>>>>>
>>>>
>>>> That one produces the intended result when run from the console, while
>>>> the attached file in your prior posting had the features you observed
>>>> (invisdble in Preview faintlt visible on Acrobat) on my mac 10.5.8
>>>> installation. R 2.10.1. Acrobat 8.1.7 and Preview Version 4.2 (469.5).
>>>>
>>>>
>>>>> Hopefully, this is not yet another instance of R-Mac-FAQ 12.10
>>>>> but something more easily treated.
>>>>>
>>>>>
>>>>> R version 2.10.1 Patched (2010-02-01 r51089)
>>>>> i386-apple-darwin9.8.0
>>>>>
>>>>> locale:
>>>>> [1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8
>>>>>
>>>>> attached base packages:
>>>>> [1] stats     graphics  grDevices utils     datasets  methods
>>>>> [7] base
>>>>>
>>>>>
>>>>> loaded via a namespace (and not attached):
>>>>> [1] tools_2.10.1
>>>>>
>>>>> R.app GUI 1.32-dev (5548 Leopard build 32-bit),
>>>>>
>>>>> Thank you.
>>>>>
>>>>> Ken
>>>>>
>>>>> Quoting Achim Zeileis <Achim.Zeileis at uibk.ac.at>:
>>>>>
>>>>>> Ken,
>>>>>>
>>>>>> an idea off-list: Have you tried
>>>>>>
>>>>>> pdf(file = "test.pdf", height = 6, width = 6)
>>>>>> ...
>>>>>> dev.off()
>>>>>>
>>>>>> with your code? This is essentially what Sweave should do internally.
>>>>>> If that replicates your problem, it might be a hint that something with
>>>>>> pdf() is not working on your machine (rather than Sweave()).
>>>>>> Z
>>>>>
>>>>>
>>>>>
>>>>> -- 
>>>>> 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
>>>>>
>>>>> _______________________________________________
>>>>> R-SIG-Mac mailing list
>>>>> R-SIG-Mac at stat.math.ethz.ch
>>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>>>>
>>>> David Winsemius, MD
>>>> Heritage Laboratories
>>>> West Hartford, CT
>>>
>>>
>>>
>>> -- 
>>> 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
>>>
>>> _______________________________________________
>>> R-SIG-Mac mailing list
>>> R-SIG-Mac at stat.math.ethz.ch
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>>>
>>
>> Thomas Lumley			Assoc. Professor, Biostatistics
>> tlumley at u.washington.edu	University of Washington, Seattle
>
>
>
> -- 
> 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
>
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.



-- 
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



More information about the R-SIG-Mac mailing list