Dear R helpers,

I am using knitr to run analysis with R and edit my document with Latex. I
am wondering whether there is a way to include 2 or more pictures per chunk
and being able to refer them in the text independently and eventually
whether it is possible to give them different captions. Let me give you an
example.Rnw:

\documentclass{article}
\title{Example}
\author{FS}
\begin{document}
\maketitle

I put some text here. I want  to plot to charts in the same figure and
label them independently.
<<stat, echo = FALSE, results = 'hide'>>=
ii <- 2000:2011
xx <- rnorm(12,0,1)
yy <- rnorm(12,0,1)
pm <- data.frame(ii,zz,yy
@

Now I generate the two pictures and put them into the same chunk with the
option out.width set to .49 so that knitr places the two charts side by
side:
<<fig:example, echo = FALSE, out.width=".49\\linewidth", fig.cap="this is
an example>>=
plot(ii,xx, type = "l")
plot(ii,yy, type = "l", lty = 2)
@

Finally, I want the reader to look at the figure on the left.
\end{document}

How can I do this? If I refer to  \ref{fig:example} I will get the number
of the figure, but of the chart on the left.
Eventually, is it possible to have separate captions for each chart?
Thanks in advance for your kind help,
f.


-- 
Francesco Sarracino, Ph.D.
https://sites.google.com/site/fsarracino/

	[[alternative HTML version deleted]]


