我一直在類似的帖子上的例子,但無濟於事。 這是我看到的問題的一個例子。ggplot2和sweave - 劇情是在Rplots而不是主要的pdf?
保存在tmp.Rnw:
\documentclass[10pt]{article}
\title{Reproducible Example}
\begin{document}
\maketitle
\begin{center}
<<echo=FALSE,results=hide>>=
library(ggplot2)
plot.to.print = qplot(1:10, 1:10)
@
\section{No Figure Below This Section Title}
<<<fig=true>>=
print(plot.to.print)
@
\end{center}
\end{document}
在tmp.co.r,我把下面的代碼:
Sweave("tmp.Rnw",stylepath=T)
我創建了TEX文件是這樣的:
/../../2.12.1/bin/R --no-save < tmp.co.r
然後在出來的tmp.tex文件上使用pdflatex。
結果是tmp.pdf,其中包含標題,節名和R代碼,但沒有圖。不過,還會生成Rplots.pdf文件,其中包含我想要的tmp.pdf圖。
我確定我在做一個新手的錯誤,但我找不到它。有小費嗎?
你有沒有試過給圖形塊命名? – baptiste