Hi, On windows I'd like to run a batchfile that leaves me a plot. As a test I have the scriptfile "test.r" which only contains: x <- 1:10; y <- sample( 10 ) plot( x, y ) Now I tried the following (but nothing worked): a) "R --vanilla < test.r" in the cmd window, => that doesn't give me a plot b) the same, but I added "bitmap(file="outplot.png")" in the scriptfile => Here I get an error that gswin32c.exe was not found. (Maybe I need to install ghostscript???) c) some attempts with Rgui.exe => I didn't arrive to pass a command argument. It would be nice, to get some hints, how this could be done. I did search the newsgroup archive, but unfortunately didn't find something. Thanks and best regards, Hans-Peter
On 6/3/05, Hans-Peter <gchappi at gmail.com> wrote:> Hi, > > On windows I'd like to run a batchfile that leaves me a plot. As a > test I have the scriptfile "test.r" which only contains: > > x <- 1:10; > y <- sample( 10 ) > plot( x, y ) > > Now I tried the following (but nothing worked): > > a) "R --vanilla < test.r" in the cmd window, => that doesn't give me a plot > b) the same, but I added "bitmap(file="outplot.png")" in the > scriptfile => Here I get an error that gswin32c.exe was not found. > (Maybe I need to install ghostscript???) > c) some attempts with Rgui.exe => I didn't arrive to pass a command argument. > > It would be nice, to get some hints, how this could be done. I did > search the newsgroup archive, but unfortunately didn't find something. >This was discussed previously this week. Look right at the end of: https://www.stat.math.ethz.ch/pipermail/r-help/2005-June/071147.html
On 6/3/05, Gabor Grothendieck <ggrothendieck at gmail.com> wrote:> This was discussed previously this week. Look right at the end of: > https://www.stat.math.ethz.ch/pipermail/r-help/2005-June/071147.htmlI had to add a "win.graph..." command, now it works: x <- 1:10; y <- sample( 10 ) win.graph(width = 7, height = 7, pointsize = 12) plot( x, y ) savePlot( filename = "test", type = "png" ) Great, thanks a lot for the tipp! Hans-Peter -- Regards, Hans-Peter
Just open a device before you plot: pdf( "plotfile.pdf" ) plot( x, y ) dev.off() also have a look at: ?Devices Best Bendix ---------------------- Bendix Carstensen Senior Statistician Steno Diabetes Center Niels Steensens Vej 2 DK-2820 Gentofte Denmark tel: +45 44 43 87 38 mob: +45 30 75 87 38 fax: +45 44 43 07 06 bxc at steno.dk www.biostat.ku.dk/~bxc ----------------------> -----Original Message----- > From: r-help-bounces at stat.math.ethz.ch > [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Gabor > Grothendieck > Sent: Friday, June 03, 2005 4:33 PM > To: Hans-Peter > Cc: r-help at stat.math.ethz.ch > Subject: Re: [R] plots from batchfile on windows > > > On 6/3/05, Hans-Peter <gchappi at gmail.com> wrote: > > Hi, > > > > On windows I'd like to run a batchfile that leaves me a plot. As a > > test I have the scriptfile "test.r" which only contains: > > > > x <- 1:10; > > y <- sample( 10 ) > > plot( x, y ) > > > > Now I tried the following (but nothing worked): > > > > a) "R --vanilla < test.r" in the cmd window, => that > doesn't give me a > > plot > > b) the same, but I added "bitmap(file="outplot.png")" in the > > scriptfile => Here I get an error that gswin32c.exe was not found. > > (Maybe I need to install ghostscript???) > > c) some attempts with Rgui.exe => I didn't arrive to pass a > command argument. > > > > It would be nice, to get some hints, how this could be done. I did > > search the newsgroup archive, but unfortunately didn't find > something. > > > > This was discussed previously this week. Look right at the end of: >https://www.stat.math.ethz.ch/pipermail/r-help/2005-June/071147.html ______________________________________________ R-help at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html