In general, Sweave is making great looking PDFs for me.
However, when I plot a histogram, it is not appearing in my PDF.
I have a bare bones Sweave document as follows. I can't seem to isolate what is missing!
\documentclass{article}
\usepackage{listings}
\begin{document}
\SweaveOpts{concordance=TRUE}
<<ReadOrder,tidy=TRUE,highlight=FALSE>>=
p <- ggplot(diamonds, aes(x=carat))
p <- p + geom_histogram()
p
@
(PS : yes, I have the 'listings' package installed in my LaTex package! And yes, the plot is being printed to the terminal.)
Thanks in advance for any advice.
Best Answer
(Upgraded from a comment).
Try adding
fig=TRUE
in the chunk options. (You might need an explicitprint()
around thep
in the last line of the chunk too ...) If you useknitr::knit
instead of Sweave, you won't need either of those explicit specifications ...