[R] Sweave: infelicities with lattice graphics

carslaw david.carslaw at kcl.ac.uk
Thu Jul 15 23:04:58 CEST 2010


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.



More information about the R-help mailing list