Phil and Jim-- Ah, thank you so much! I had read all the help files on jpeg() and dev.off(), but I had not caught on to the fact that image.plot() comes *between* jpeg() and dev.off(), not before them! (though I guess it's supposed to be obvious from the example code).
Again, thanks! --Sarah On Tue, Mar 30, 2010 at 4:17 PM, Phil Spector <spec...@stat.berkeley.edu> wrote: > Sarah - > Those lines alone only open the jpeg device -- they > don't actually produce any output. Normally, you'd steps > like this to save a JPEG file > > jpeg(filename='myfile.jpg',height ..... > --- plotting commands go here --- > dev.off() > > The call to dev.off() is what actually creates the file. > > If you've already created the image, and want to transfer > it to a jpeg file, take a look at ?dev.copy > > Hope this helps. > > - Phil Spector > Statistical Computing Facility > Department of Statistics > UC Berkeley > spec...@stat.berkeley.edu > > > > > On Tue, 30 Mar 2010, Sarah Berke wrote: > >> Hi, >> >> I am having trouble saving graphics from R. jpeg() saves a file with >> the correct name to the correct directory, but it consists of a blank >> (white) jpeg with the specified dimensions--the image itself is not >> being saved. >> >> My code is >> >> jpeg(filename="myfile.jpg", >> height = 2.5, width = 8, units = "in", res = 72, >> pointsize = 12, quality = 100, bg = "white", >> restoreConsole = TRUE) >> >> I have tried different heights and widths, thinking that I had a >> margins problem, but no luck. I have also verified that ghostscript >> is installed, and that the environmental variable "R_GSCMD" is set to >> the correct path to gswin32c.exe. Oh, and the image device itself >> displays properly in the R graphics window. I can just manually save >> it through the menu, but I want to have more control over the >> dimensions. >> >> I have also tried bitmap() and png() to no avail. >> >> Any advice would be much appreciated! >> >> Thanks, >> Sarah >> >> ______________________________________________ >> 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. >> > ______________________________________________ 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.