我使用这段代码来在Sweave
中制作图形
<<label=fig1plot, include=FALSE >>=
plot(cars)
@
\begin{figure}
\begin{center}
<<label=fig1, fig=TRUE, echo=FALSE>>=
<<fig1plot>>
@
\end{center}
\caption{Some caption}
\label{fig:fig1plot}
\end{figure}
<<label=fig2plot, include=FALSE >>=
plot(table(rpois(100,5)), type = "h", col = "red", lwd=10, main="rpois(100,lambda=5)")
@
\begin{figure}
\begin{center}
<<label=fig2, fig=TRUE, echo=FALSE>>=
<<fig2plot>>
@
\end{center}
\caption{Some caption}
\label{fig:fig2plot}
\end{figure}
现在我希望能够将这两个图并排放置,并且加上像Fig 1(a)和Fig 1(b)这样的标题。非常感谢您的时间和帮助,欢迎提出任何想法、评论和指南。
\usepackage{subcaption}
后,即使没有添加任何子图,我也会收到像“\caption will not be redefined since it's already redefined by a document class or package which is unknown to the caption package. The `subcaption' package does not work correctly.”这样的消息。我猜测自那个答案被接受以来可能发生了一些变化... - liori