[Rd] Sweaving in png

Friedrich.Leisch at tuwien.ac.at Friedrich.Leisch at tuwien.ac.at
Mon Mar 27 09:58:07 CEST 2006


Yes, I have that on mmy 2do list for quite some time now. Could you
send me your patches to the code?

Fritz


>>>>> On Sun, 26 Mar 2006 19:58:40 -0500,
>>>>> Roger Peng (RP) wrote:

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

  > ______________________________________________
  > R-devel at r-project.org mailing list
  > https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list