cameronbracken / pgfSweave

Quality graphics and speedy compilation with Sweave
http://r-forge.r-project.org/projects/pgfsweave/
29 stars 6 forks source link

about the bug #2 in README (Rplot.pdf) #8

Closed yihui closed 13 years ago

yihui commented 13 years ago

If you have not solved that problem, I guess here is the answer: http://yihui.name/en/2010/12/a-special-graphics-device-in-r-the-null-device/

cameronbracken commented 13 years ago

Thanks, I was always wondering about that, just put it in and it seems to work!

yihui commented 13 years ago

Issue 20 reminds us that this null device does not work for certain cases...

An old issue came to my mind again: is it possible to evaluate the code chunk only once when fig=T? I guess the original design of Sweave wanted to produce plots of more than one formats (typically pdf and eps), so Sweave repeats the evaluation of a code chunk in every graphics device.

Nowadays, I think we rarely worry about whether people run latex (eps) or pdflatex (pdf); I have not used eps figures for several years. A single graphics device should be enough for every code chunk, so can we open that graphics device before we evaluate the code? In this case, there will not be any Rplots.pdf any more, and it will also save us a lot of time, which is currently wasted in producing those redundant files. This is the real solution to issue 20 and this issue. However, I guess it might require some sort of rewriting Sweave. You may discard this idea. I can stand the redundancy :)

cameronbracken commented 13 years ago

I have yet to dig into the Sweave code to find out exactly how or why this is how it is. But is is good to keep in mind and check into later.