Hi List, My apologies in advance if question is simplistic, I am quite new to R graphics capabilities and I could not find anything in past threads... I use R 2.8.1 under Mac OS X, but I would preferrably have a cross platform answer as I use also R under Windows I produce plots using R & save them in a file e.g. below: y <- rnorm(1000) x <- rnorm(1000) plot(x,y) dev.copy2pdf() Until there fine, it create a pdf file that is composed of my plot...My "issues" are the following: 1. If I want to produce the plot & save it directly in a pdf file without viewing it, how do I do that? 2. Can I create several plots in a row (without showing them in Quartz or whatever other graphic device) and save them all in separate files after creation? for example a function that would save me in separate files all what is visible through dev.list() Let's keep the example of saving in pdf format here...I do not have target file type for saving the graphics. The point is that I would have another piece of code (HTML I guess, not developed yet) fetching all the charts and presenting it nicely. Any feedback is appreciated Many thanks Julien _________________________________________________________________ charlas. [[alternative HTML version deleted]]
pdf("yourFile.pdf") plot(1) plot(2) plot(3) ..... dev.off() On Wed, Jan 28, 2009 at 12:26 PM, julien cuisinier <j_cuisinier at hotmail.com> wrote:> > Hi List, > > > My apologies in advance if question is simplistic, I am quite new to R graphics capabilities and I could not find anything in past threads... > > I use R 2.8.1 under Mac OS X, but I would preferrably have a cross platform answer as I use also R under Windows > > I produce plots using R & save them in a file > > e.g. below: > > y <- rnorm(1000) > x <- rnorm(1000) > plot(x,y) > dev.copy2pdf() > > Until there fine, it create a pdf file that is composed of my plot...My "issues" are the following: > 1. If I want to produce the plot & save it directly in a pdf file without viewing it, how do I do that? > 2. Can I create several plots in a row (without showing them in Quartz or whatever other graphic device) and save them all in separate files after creation? for example a function that would save me in separate files all what is visible through dev.list() > > Let's keep the example of saving in pdf format here...I do not have target file type for saving the graphics. The point is that I would have another piece of code (HTML I guess, not developed yet) fetching all the charts and presenting it nicely. > > > Any feedback is appreciated > > Many thanks > Julien > > _________________________________________________________________ > > charlas. > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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. >-- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve?
Try pdf("foo.pdf") plot(x) dev.off() Other possibilities are jpeg(), tiff(), postscript() etc. HTH, Stephan julien cuisinier schrieb:> Hi List, > > > My apologies in advance if question is simplistic, I am quite new to R graphics capabilities and I could not find anything in past threads... > > I use R 2.8.1 under Mac OS X, but I would preferrably have a cross platform answer as I use also R under Windows > > I produce plots using R & save them in a file > > e.g. below: > > y <- rnorm(1000) > x <- rnorm(1000) > plot(x,y) > dev.copy2pdf() > > Until there fine, it create a pdf file that is composed of my plot...My "issues" are the following: > 1. If I want to produce the plot & save it directly in a pdf file without viewing it, how do I do that? > 2. Can I create several plots in a row (without showing them in Quartz or whatever other graphic device) and save them all in separate files after creation? for example a function that would save me in separate files all what is visible through dev.list() > > Let's keep the example of saving in pdf format here...I do not have target file type for saving the graphics. The point is that I would have another piece of code (HTML I guess, not developed yet) fetching all the charts and presenting it nicely. > > > Any feedback is appreciated > > Many thanks > Julien > > _________________________________________________________________ > > charlas. > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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. >