On Fri, 13 Nov 2009, Michael Friendly wrote:
Alternatively, is there a way to generate .png graphs from the .Rnw file
so that those are used in building
the .pdf for the package? AFAICS, \SweaveOpts{} offers only the choices
of eps/pdf = {TRUE/FALSE}.
Yes, but you can call the png() device yourself within the code chunk
<<>>=
png(file = "fig1.png", ...)
...
dev.off()
@
and then put
\includegraphics{fig1}
manually into the LaTeX. It's certainly not as nice as Sweave's automatic
handling of figures but will work and still keep the file self-contained.
Z
Thanks, Achim
This works, but has the infelicitous effect that both the png() call and
dev.off(), with its output appear in the vignette (with echo=TRUE)
% do .png manually ...
<<fig1cpng, fig=TRUE, pdf=FALSE, eval=TRUE, echo=TRUE, debug=TRUE,
results=verbatim, include=FALSE>>=
png(file="figs/fig-fig1c.png", width=4, height=4, units="in", res=72)
# plot stuff ...
dev.off()
@
I suppose I could break this up into 3 chunks as follows, but is there some
other way, either with R or LaTeX constructs?
<<echo=FALSE>>=
png(file="figs/fig-fig1c.png", width=4, height=4, units="in", res=72)
@
<<fig1cpng, fig=TRUE, pdf=FALSE, eval=TRUE, echo=TRUE, debug=TRUE,
results=verbatim, include=FALSE>>=
# plot stuff ...
@
<<echo=FALSE>>=
dev.off()
@