Reputation: 3105
I'm running the latest RStudio (0.97.551) and R (3.0.1) version on Mac OS X Mountain Lion 10.8.4.
I have the following two files: test.Rnw
\documentclass{article}
<<set-options, echo=FALSE>>=
options(replace.assign=TRUE)
opts_chunk$set(external=TRUE, cache=TRUE, echo=FALSE, fig=TRUE)
read_chunk('chunks.R')
@
\begin{document}
\section{Graphics}
<<chart, fig.height=4>>=
@
\end{document}
and chunks.R
## @knitr chart
library(ggplot2, quietly=TRUE)
Sys.sleep(3)
p <- ggplot(mtcars, aes(wt, mpg)) + geom_point(aes(size = qsec)) +
labs(title ="title with umlauts ä")
p
sessionInfo()
When knitting this document in RStudio everything is fine:
Now I clear the cache and knit the document manually from a script running the commands:
export TEXINPUTS=$TEXINPUTS:/Library/Frameworks/R.framework/Versions/Current/Resources/share/texmf/tex/latex/
/usr/bin/Rscript -e "library(knitr); knit(\"test.Rnw\")"
pdflatex ./test.tex
Everything is still fine.
But then I don't clear the cache and knit again in RStudio. the PDF-viewer of RStudio now displays the chart as follows:
Mac OS X Preview shows both pdfs fine. The only difference in sessionInfo() I can see is the order of the base packages.
Has anyone an idea why RStudio shows the graphic wrong?
I don't know how to share the two pdfs. So if anyone needs them and tells me how to share them, I'll do it.
TIA, JW
Upvotes: 1
Views: 767
Reputation: 30124
RStudio sets grDevices::pdf.options(useDingbats = FALSE)
before it calls knitr
(see the panel Compile PDF
which contains the log), and the option useDingbats
is TRUE
by default in R. RStudio's built-in PDF viewer does not honor the Dingbats font, so the circles (solid points) were broken in its PDF viewer when useDingbats = TRUE
. See ?pdf
for more information.
You should not use RStudio's PDF viewer to view the PDF generated outside of RStudio by yourself. There are other good choices in Tools -> Options -> Sweave -> PDF preview
, such as Sumutra PDF
under Windows, and evince
under Linux. I have no idea about Mac OS X, though (at least you can use the default viewer of the system, I believe).
Upvotes: 3