On 12/04/2010 12:08 PM, michele donato wrote:
Hi,
I am trying to get figures from multiple source files in Sweave. My test
file is as follows
\documentclass{article}
\usepackage{Sweave}
\begin{document}
\begin{section}{notitle}
This is a simple Sweave test
<<gethypergraphs_rhea,fig=TRUE,echo=F>>=
source("./testfig.r")
@
\\
End of the simple sweave test
\end{section}
\end{document}
where testfig.r is as simple as
plot(1:20)
plot(1:5)
The figures are correctly generated in the folder, as a .pdf/.eps with
two pages, each page a plot
the resulting tex file is
\documentclass{article}
\usepackage{Sweave}
\begin{document}
\begin{section}{notitle}
This is a simple Sweave test
\includegraphics{coupling_images_report-gethypergraphs_rhea}
\\
End of the simple sweave test
\end{section}
\end{document}
When I compile the .tex file, however, the figures are overlapped one on
top of the other.
I tried to search for a solution, but found none...
This doesn't really have to do with source() or even Sweave:
\includegraphics wants just one figure per file. In Sweave, that means
you need to put separate figures in separate code chunks (or use
par(mfrow= ...) or something to allow both to be plotted on the same page).
Duncan Murdoch
______________________________________________
R-help@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.