[R] Sweave: side by side dynamic graphs

Felipe Carrillo mazatlanmexico at yahoo.com
Mon Nov 3 05:28:29 CET 2008


Hi all:
I'm trying to create some side by side dynamic graphics on the same page but I am running into some problems. I am able to create side by side figures only if I import them into my PDF. see the example bellow:

\documentclass[12pt]{article}
\usepackage{color,cite,graphicx}% to put in axodraw
\usepackage{latexsym,amssymb,epsf}
\begin{document}
%Import two figures side by side. Please Replace the 'bar' picture with any
% jpeg picture to make this example reproducible.
\begin{figure}[h]
\centerline{\mbox{\includegraphics[width=3.00in]{bar}}
\mbox{\includegraphics[width=3.00in]{bar}}}
\end{figure}

% I would like to create two dynamic graphics here side by side
%but isn't working.
\begin{figure}[h]
\centering
<<fig.R,echo=F,fig=T,width=2.5,height=2.5>>=
plot(1:10}
@
\caption{This is the first graph}
\end{figure}
\begin{figure}
\centering
<<fig.R,echo=F,fig=T,width=3,height=3>>=
plot(1:15)
@
\caption{This is the second graph}
\end{figure}
\end{document}

Thanks for your help

Felipe D. Carrillo  
Supervisory Fishery Biologist  
Department of the Interior  
US Fish & Wildlife Service  
California, USA



More information about the R-help mailing list