无法在knitr中为横向格式图添加标题

时间:2017-08-20 10:47:40

标签: r latex knitr

\documentclass{article}
\usepackage{pdflscape}
\begin{document}
\begin{landscape}
The graph (fig. \ref{fig:mygraph1}in landscape format works fine.
<<mygraph1,out.width='1\\linewidth', fig.width=11.5, fig.height=6, echo=FALSE 
>>=
graph <- c(1, 7, 9, 11, 9)
plot(graph)
@
But when adding a caption the figure breaks
<<mygraph2,out.width='1\\linewidth', fig.width=11.5, fig.height=6, echo=FALSE, 
fig.cap="Caption">>=
graph <- c(1, 7, 9, 11, 9)
plot(graph)
@
And breaks if made into a latex figure
\begin{figure}
<<mygraph3,out.width='1\\linewidth', fig.width=11.5, fig.height=6, echo=FALSE 
>>=
graph <- c(1, 7, 9, 11, 9)
plot(graph)
@
\end{figure}
\end{landscape}
\end{document}

这似乎在这里回答:knitr Rnw latex: how to obtain a figure and caption in landscape mode that's full page width

然而,把这个块放在\ begin {figure}中实际上似乎并不是一个解决方案。至少对我来说,这个数字仍然打破了横向。 有什么想法吗?

0 个答案:

没有答案