Re: [R] beamer overlays with Sweave?

From: Philipp Pagel <p.pagel_at_wzw.tum.de>
Date: Tue, 08 Mar 2011 09:30:38 +0100

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

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Tue 08 Mar 2011 - 08:33:52 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 08 Mar 2011 - 09:00:19 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive