Jun Shen
2015-Jul-04 03:05 UTC
[R] How to feed graphic device (png, jpeg etc) with different files names
Dear list, I define a function to export a bunch of plots. A sample code is something like the follow export.plots<-function(export.type='pdf',...){ match.fun(export.type) (...) print(plot.func1(...)) print(plot.func2(...)) print(plot.func3(...)) ... print(plot.funcn(...)) dev.off() } If I do pdf , everything can be exported into one file. But for other devices, each graph is one file. Since I have so many graphs to export, I can't tell which is what from the file names. I was thinking if I can construct a file name for each of the 'print" function then to feed the information to the graphic device to have an informative file name. Is it possible? Thanks. Jun [[alternative HTML version deleted]]
Jeff Newmiller
2015-Jul-04 03:30 UTC
[R] How to feed graphic device (png, jpeg etc) with different files names
Use dev.off and re-open the device. --------------------------------------------------------------------------- Jeff Newmiller The ..... ..... Go Live... DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/Batteries O.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --------------------------------------------------------------------------- Sent from my phone. Please excuse my brevity. On July 3, 2015 8:05:44 PM PDT, Jun Shen <jun.shen.ut at gmail.com> wrote:>Dear list, > >I define a function to export a bunch of plots. A sample code is >something >like the follow > >export.plots<-function(export.type='pdf',...){ > >match.fun(export.type) (...) > >print(plot.func1(...)) >print(plot.func2(...)) >print(plot.func3(...)) >... >print(plot.funcn(...)) > >dev.off() > >} > >If I do pdf , everything can be exported into one file. But for other >devices, each graph is one file. Since I have so many graphs to export, >I >can't tell which is what from the file names. I was thinking if I can >construct a file name for each of the 'print" function then to feed the >information to the graphic device to have an informative file name. Is >it >possible? Thanks. > >Jun > > [[alternative HTML version deleted]] > >______________________________________________ >R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >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.