Hello list, despite I already posted a mail on this topic on R help, I guess this place may be more appropriate. I'll make it shorter this time. Sorry for posting twice. I found that using pixmap pictures in a Sweave document was sometimes almost impossible, due to the huge size of the pdf pictures produced. The first solution I found was to save pictures in png, when too heavy in pdf. Here is an example: ### in a .rnw document ### % here is an invisible chunck to create a picture <<fig =FALSE,echo=FALSE>>png(filename='figs/myPic.png') @ % next, R code to generate picture <<fig=FALSE,echo=TRUE>>...[code to produce the figure] @ % then, close the device. Hidden, again <<fig =FALSE,echo=FALSE>>dev.off() @ % and then, include it as a picture \includegraphics{figs/myPic.png} ### end of the example ### I This is quite long, and I would have prefered to need simply: <<fig=TRUE,pdf=FALSE,png=TRUE>> ...[code to produce the figure] @ So I tried to adapte the Sweave driver 'RweaveLatex' in order to do so. It worked. The not-so-new driver is only a slight modification of RweaveLatex, and can generate ps, pdf or png figures; it was tested on Ubuntu64, Debian, several Windows systems and macOS X partforms with no detected problem. Does someone find this useful, and/or were there better solutions I missed? Regards, Thibaut Jombart . -- ###################################### Thibaut JOMBART CNRS UMR 5558 - Laboratoire de Biom?trie et Biologie Evolutive Universite Lyon 1 43 bd du 11 novembre 1918 69622 Villeurbanne Cedex T?l. : 04.72.43.29.35 Fax : 04.72.43.13.88 jombart at biomserv.univ-lyon1.fr <https://stat.ethz.ch/mailman/listinfo/r-help>
For what it's worth, I would find such a adaptation useful. -roger Thibaut Jombart wrote:> Hello list, > > despite I already posted a mail on this topic on R help, I guess this place may be more appropriate. > I'll make it shorter this time. Sorry for posting twice. > > I found that using pixmap pictures in a Sweave document was sometimes almost impossible, due to the huge size of the pdf pictures produced. > > The first solution I found was to save pictures in png, when too heavy in pdf. Here is an example: > > ### in a .rnw document ### > > % here is an invisible chunck to create a picture > <<fig =FALSE,echo=FALSE>>> png(filename='figs/myPic.png') > @ > > % next, R code to generate picture > <<fig=FALSE,echo=TRUE>>> ...[code to produce the figure] > @ > > % then, close the device. Hidden, again > <<fig =FALSE,echo=FALSE>>> dev.off() > @ > > % and then, include it as a picture > \includegraphics{figs/myPic.png} > > ### end of the example ### > > I > This is quite long, and I would have prefered to need simply: > > <<fig=TRUE,pdf=FALSE,png=TRUE>> > ...[code to produce the figure] > @ > > So I tried to adapte the Sweave driver 'RweaveLatex' in order to do so. It worked. > > The not-so-new driver is only a slight modification of RweaveLatex, and can > generate ps, pdf or png figures; it was tested on Ubuntu64, Debian, > several Windows systems and macOS X partforms with no detected problem. > > Does someone find this useful, and/or were there better solutions I missed? > > Regards, > > Thibaut Jombart . >-- Roger D. Peng | http://www.biostat.jhsph.edu/~rpeng/