[R] beamer overlays with Sweave?
Philipp Pagel
p.pagel at wzw.tum.de
Tue Mar 8 09:30:38 CET 2011
> This may be asking too much, but I'm wondering if anyone has a
> solution (even a hack) for creating multiple (overlay) plots in an
> Sweave file and post-processing the overlays in beamer appropriately.
Although I have not done this with beamer and overlays before, I once
had to resort to generating the includegraphics commands from within a
loop in order to save substantial amoutns of typing. You could do
something similar along these lines (untested):
<<echo=F>>=
slidenum <- 1
plotbasename <- "something"
plotfilename <- paste(plotbasename, slidenum, ".pdf", sep="")
pdf(file=plotfilename)
plot(stuff)
dev.off()
cat("\\only", slidenum, "{\includegraphics{", plotfilename ,"}}\n" ,sep="")
@
<<echo=F>>=
slidenum <- slidenum + 1
plotfilename <- paste(plotbasenema, slidenum, ".pdf", sep="")
pdf(file=plotfilename)
plot(stuff)
dev.off()
cat("\\only", slidenum, "{\includegraphics{", plotfilename ,"}}\n" ,sep="")
@
If you want toget really fancy, you could wrap most of this in a
conveniance function...
cu
Philipp
--
Dr. Philipp Pagel
Lehrstuhl für Genomorientierte Bioinformatik
Technische Universität München
Wissenschaftszentrum Weihenstephan
Maximus-von-Imhof-Forum 3
85354 Freising, Germany
http://webclu.bio.wzw.tum.de/~pagel/
More information about the R-help
mailing list