4

I am trying out Knitr with RStudio. The output of plot() is now showing up in the compiled PDF.

Below is an example. The code shows up in the PDF, but not the plot.

\documentclass[11pt]{article}


\begin{document}
\SweaveOpts{concordance=TRUE}


<<my-label, eval=TRUE>>=
plot(1:20)
@


\end{document}

I'm not sure what I'm missing here?

Ravi
  • 119
  • 1
  • 5

1 Answers1

2

Your example doesn't work for me as is, but if I comment out \SweaveOpts{concordance=TRUE} and click 'Compile PDF', it works (and I can see the plot).

(Note that I too am using Knitr with pdfLaTeX within RStudio.)

Ian Gow
  • 3,098
  • 1
  • 25
  • 31
  • 3
    Hi, thanks for your comment, it pointed me in the right direction. I had to go to Tools -> Global Options -> Sweave, and set the Weave Rnw files option to use "knitr" rather than Sweave. Once I changed this, and deleted the "\SweaveOpts" line, the plot showed up fine and the "\SweaveOpts" line was not automatically generated anymore. – Ravi Jan 23 '15 at 20:29
  • @Ravioli Essentially the same issue as http://stackoverflow.com/a/27607563/559676 – Yihui Xie Jan 29 '15 at 02:31