[R] vignettes: .png graphics or pre-compiled .pdf

Yihui Xie xieyihui at gmail.com
Sat Nov 14 21:41:47 CET 2009


Yes, I also wish Sweave could give us more flexible options, e.g. it
should not be difficult to free the graphics device specification as
an R function (pdf, png, CairoPDF, ...) instead of just letting us set
pdf=T/F and eps=T/F.

If we don't want to hack the Sweave code, we may also rewrite it as a
package. This has been in my mind for a long time.

Regards,
Yihui
--
Yihui Xie <xieyihui at gmail.com>
Phone: 515-294-6609 Web: http://yihui.name
Department of Statistics, Iowa State University
3211 Snedecor Hall, Ames, IA



2009/11/14 Michael Friendly <friendly at yorku.ca>:
> Thanks, Yihui
> Your solution, for png(), only looks dirty because you had to hack the Sweave code.
> It would be nice to have png() support included directly.
>
> Yihui Xie wrote:
>>
>> I was reminded that the attachments were blocked by the list, so I
>> send these links again:
>>
>> http://yihui.name/en/wp-content/uploads/2009/11/Sweave2.Rnw
>> http://yihui.name/en/wp-content/uploads/2009/11/Sweave2.r
>> http://yihui.name/en/wp-content/uploads/2009/11/Sweave2.pdf
>>
>> Regards,
>> Yihui
>> --
>> Yihui Xie <xieyihui at gmail.com>
>> Phone: 515-294-6609 Web: http://yihui.name
>> Department of Statistics, Iowa State University
>> 3211 Snedecor Hall, Ames, IA
>>
>>
>>
>> On Fri, Nov 13, 2009 at 8:31 PM, Yihui Xie <xieyihui at gmail.com> wrote:
>>
>>>
>>> Hi Michael,
>>>
>>> I have a dirty solution as attached to use png() for Sweave.
>>>
>>> HTH.
>>>
>>> Regards,
>>> Yihui
>>> --
>>> Yihui Xie <xieyihui at gmail.com>
>>> Phone: 515-294-6609 Web: http://yihui.name
>>> Department of Statistics, Iowa State University
>>> 3211 Snedecor Hall, Ames, IA
>>>
>>>
>>> On Fri, Nov 13, 2009 at 10:02 AM, Michael Friendly <friendly at yorku.ca> wrote:
>>>
>>>>
>>>> In a package I'm working on there is a vignette with a number of graphs that
>>>> result in huge .pdf files, so
>>>> the .pdf for the vignette is around 17 Mb.  If these graphs are converted to
>>>> .png, and the .tex file
>>>> is compiled with pdflatex, the resulting .pdf is ~1 Mb.
>>>>
>>>> I'm reluctant to put the .Rnw file into the package as is, generating the
>>>> huge .pdf for the vignette.
>>>> I first tried installing the smaller .pdf file in the package by itself (no
>>>> .Rnw)
>>>> together with a file inst/doc/index.html as recommended
>>>> in 'Writing R Extensions.'  However, when the package is installed,
>>>> vignette() can't find it
>>>>
>>>>
>>>>>
>>>>> vignette(package="Guerry")
>>>>>
>>>>
>>>> no vignettes found
>>>>
>>>>>
>>>>> vignette("MultiSpat")
>>>>>
>>>>
>>>> Warning message:
>>>> vignette 'MultiSpat' *not* found
>>>>
>>>> Alternatively, is there a way to generate .png graphs from the .Rnw file so
>>>> that those are used in building
>>>> the .pdf for the package?  AFAICS, \SweaveOpts{} offers only the choices of
>>>> eps/pdf = {TRUE/FALSE}.
>>>>
>>>> -Michael
>>>>
>>>> --
>>>> Michael Friendly     Email: friendly AT yorku DOT ca Professor, Psychology
>>>> Dept.
>>>> York University      Voice: 416 736-5115 x66249 Fax: 416 736-5814
>>>> 4700 Keele Street    http://www.math.yorku.ca/SCS/friendly.html
>>>> Toronto, ONT  M3J 1P3 CANADA
>>>>
>>>> ______________________________________________
>>>> R-help at r-project.org mailing list
>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>>>> and provide commented, minimal, self-contained, reproducible code.
>>>>
>>>>
>>
>>
>
>
> --
> Michael Friendly     Email: friendly at yorku.ca Professor, Psychology Dept.
> York University      Voice: 416 736-5115 x66249 Fax: 416 736-5814
> 4700 Keele Street    http://www.math.yorku.ca/SCS/friendly.html
> Toronto, ONT  M3J 1P3 CANADA
>
>




More information about the R-help mailing list