I have wondered about this too.  The approach I use isn't pretty but does
have a couple of advantages - there is only one set of code to run and I
have control over the figure size.  

The first part of the code below is what is shown in the document (but not
run), and the second part actually runs the code and makes the plot.

<<no2hist, eval=FALSE>>=
hist(mydata$no2)
<<no2hist1, echo = FALSE, results=hide>>=
pdf("no2hist.pdf")
<<no2hist>>
dev.off()
@
\begin{figure}
    \centering
    \includegraphics[width=0.5\textwidth]{no2hist}
    \caption{The caption.}
       \label{fig:hist}
\end{figure}

I'd be interested to know if there are neater ways of doing this.

Regards,

David
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Sweave-infelicities-with-lattice-graphics-tp2290665p2290677.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
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.

Reply via email to