Hi, now I see the problem is that it is not possible to run dev.copy from non-interactive devices (see the post in r-devel: "[Rd] feature enhancement request & patch: dev.control(displaylist='en (PR#3424)" Tue 08 Jul 2003 - 03:50:38 EST).
I'll move this question to the r-devel list. Giampiero On Wed, 28 Feb 2007, Giampiero Salvi wrote: > Hi, > I am trying to create a plot and save it as pdf to the file > file1.pdf, then add some details and save the new plot as file2.pdf. > I would like to avoid repeating all the instructions needed to create > file1.pdf when I create file2.pdf. > > This is what I have tried: > > pdf(file="file1.pdf") > plot(1:10) > dev.copy(pdf,file="file2.pdf") > points(2,3) > dev.off() > dev.off() > > When I run points I get the error: > Error in plot.xy(xy.coords(x, y), type = type, ...) : > plot.new has not been called yet > > When I try to do the same with the x11 device, it works: > x11() > plot(1:10) > dev.copy(x11) > points(2,3) > dev.off() > dev.off() > > Can someone tell me what goes wrong in the first case and why the x11 > and pdf devices behave differently? > > Thank you! > Giampiero > ______________________________________________ [email protected] 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.
