knitr - How to align code and plot side by side

前端 未结 3 1115
半阙折子戏
半阙折子戏 2021-02-20 11:25

is there a simple way (e.g., via a chunk option) to get a chunk\'s source code and the plot it produces side by side, as on page 8 (among others) of this document?

I tri

3条回答
  •  情话喂你
    2021-02-20 12:02

    I see 3 possibilities

    • for beamer presentations, I'd go for \begin{columns} ... \end{columns} as well.
    • If it is only one such plot: Minipages
    • Here I used a table (column code and column result). (This example is "normal" Sweave)

    For all three, the chunk options would have include = FALSE, and the plot would "manually" be put to the right place by \includegraphics[]{}.

提交回复
热议问题