From rpeng at jhsph.edu  Mon Mar 27 02:58:40 2006
From: rpeng at jhsph.edu (Roger Peng)
Date: Sun, 26 Mar 2006 19:58:40 -0500
Subject: [Rd] Sweaving in png
In-Reply-To: <4423FE7D.8020907@biomserv.univ-lyon1.fr>
References: <4423FE7D.8020907@biomserv.univ-lyon1.fr>
Message-ID: <442738C0.6020800@jhsph.edu>

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/



[Rd] Sweaving in png
Roger Peng