I like the tikzDevice package and use it frequently, but in this case
I guess it cannot help much -- the huge tikz plots may even not be
able to get compiled to PDF successfully due to memory limits.
However, I think Graham's question has pointed out a very useful
direction -- we may consider leaving some sort of API's or hooks in
the R script in LyX which is used to process the Rnw document. I mean,
e.g., we let the user define a function to post-process all the PDF's
generated by Sweave and this function can be called after Sweave has
finished processing the Rnw document. This is not hard to implement. I
have some similar ideas implemented in my patch to the current Sweave
module (http://www.lyx.org/trac/ticket/7555; see the PDF documents
there).

A few months ago I also recommended the qpdf program to R developers
to compress PDF plots and it has been included in R now (the option
--compact-vignettes in R CMD build). Graham, is your script portable
to Windows and Mac? Could you share it with us? Maybe we can propose
this feature to LyX developers. It will be definitely helpful.

Regards,
Yihui
--
Yihui Xie <xieyi...@gmail.com>
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA



On Sun, May 29, 2011 at 4:18 PM, Renaud Lacour <ren...@home-dn.net> wrote:
> Le Sun, 29 May 2011 21:26:57 +0100,
> Graham Smith <myotis...@gmail.com> a écrit :
>
>>  I'm looking for some advice on format and quality specification for
>> exporting graphs from R to go into a Lyx Document, that will end up as a
>> printed document.
>>
>> At the moment each graph using the R defaults is a 3 - 4mb PDF, and I am
>> using them as 9cm x 9cm in the document.
>>
>> Has anyone got  a standard spec that they use for exporting from R to
>> keep the file size as small as possible while still giving high quality
>>
>> I am less than half way through a document which currently has 122
>> graphs (each 9cm x 9cm) in it that gives me  a PDF of half a Gb. I can
>> compress the PDF with a Nautilus script down to 11Mb, but it would make
>> sense to export graphs that were as small as possible. At half a Gb,
>> the preview scrolls really badly on my PC.
>>
>> Many thanks,
>>
>> Graham
> Hi,
>
> You could try the R package tikzDevice which generates PGF/Tikz graphics
> suitable for inclusion in your Latex/Lyx document. Contrary to pictex
> which is deprecated, tikzDevice will provide you with full color high
> quality graphics suitable for compilation with pdflatex. Moreover, pdf
> documents that include such graphics seem to be rather small.
>
> Regards,
>
> --
> Renaud Lacour <ren...@home-dn.net>
>

Reply via email to