Dear list. I am preparing a R package, and the last step is to write a package vignette using Sweave. However, I am experiencing some trouble when trying to include plots in my Sweave document. That is, in my package I have made some plotting functions in which I start by calling 'new.dev()' to start a graphics device of a certain width and height, and then proceed with plot(). These functions work perfectly fine in R, and when I check and build my package with R CMD build/check.
The problems start when I try to include the command and the output of my plotting functions in the Sweave document, and I suspect it must have something to do with the command 'dev.new()' in my code. Here is a basic example of a Sweave file which can hopefully illustrate the problem: \documentclass[a4paper]{article} \usepackage{Sweave} \RequirePackage{graphicx,fancyvrb} \title{Sweavetest} \begin{document} \section{Plotting} <<label=testfig,include=FALSE,echo=TRUE>>= dev.new(width=7,height=6,record=TRUE) plot(1:10,col="red") @ \begin{figure}[ht] \begin{center} <<label=fig,fig=TRUE,echo=FALSE>>= <<testfig>> @ \end{center} \caption{Testplot} \label{fig:test} \end{figure} \end{document} When I run Sweave on this file I get empty pdf and eps files named "Sweavetest-fig.pdf" and "Sweavetest-fig.eps", and the corresponding latex file is unable to create a PDF-file. Does anyone know what the problem is, and how I might solve it? This is the first time that I have worked with Sweave, so I might be missing something basic... Best regards, Gro Nilsen PhD-student, University of Oslo ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.