繁体   English   中英

knitr:有没有办法让R的多个输出绘制到每个幻灯片上?

[英]knitr: Is there a way to make multiple output of R plotting into each slide?

假设我有一个R卡盘,例如:

\documentclass[xcolor=x11names,compress]{beamer}
    \begin{frame}[fragile]{Visualization}                                                                                                                               
        <<echo=FALSE, results="asis", fig.keep="all", tidy=TRUE>>= 
        library(knitr)                                                                                                                                                  
        for (i in 1:100){
            plot(rnorm(100))
        }                                                                                                                                                                      
        @                                                                                                                                                                                         
   \end{frame} 
\end{document}

我的问题是如何使每张幻灯片中显示的100个图而不是保持在一张幻灯片中?

如果您提供“ allowframebreaks”选项,则Beamer可以拆分幻灯片。 多少页似乎有一些限制,但这可行:

\documentclass[xcolor=x11names,compress]{beamer}
\begin{document}
\begin{frame}[allowframebreaks]{Visualization}
<<echo=FALSE, fig.height=4>>=
for (i in 1:10){
    plot(rnorm(100))
}
@
\end{frame} 
\end{document}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM