我一直在类似的帖子上的例子,但无济于事。 这是我看到的问题的一个例子。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