OP does not want to depend on RStudio. Bert. Need to open a graphics device. Which one you use is highly dependent on your needs and OS configuration. https://stat.ethz.ch/R-manual/R-devel/library/grDevices/html/Devices.html
On January 26, 2020 8:06:24 AM PST, Bert Gunter <bgunter.4...@gmail.com> wrote: >Google is your friend! > >https://stackoverflow.com/questions/26643852/ggplot-plots-in-scripts-do-not-display-in-rstudio > >Bert Gunter > >"The trouble with having an open mind is that people keep coming along >and >sticking things into it." >-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) > > >On Sun, Jan 26, 2020 at 7:30 AM Felix Blind <felixbl...@gmail.com> >wrote: > >> Dear R users, >> >> i am a python user trying to get my statistical knowledge up to speed >> and R is the language for that. >> I would like to run R scripts like that: R -f script.r and still get >the >> plots that pop up. >> >> When I type the following code in the R REPL I get a nice plot: >> >> >> library(ggplot2) >> >> data("midwest", >> >> package="ggplot2") >> >> ggplot(midwest, aes(x=area, y=poptotal)) + geom_point() >> >> But when I put the same code in a file script.r and run it with R -f >> script.r or if I source it in the REPL with source("script.r") I do >not >> get any plots shown. >> >> Can you guys tell me what I do wrong. (Apart from either using >RStudio >> or the REPL exclusively) >> >> Kind regards, >> Felix >> >> ______________________________________________ >> R-help@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. >> > > [[alternative HTML version deleted]] > >______________________________________________ >R-help@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. -- Sent from my phone. Please excuse my brevity. ______________________________________________ R-help@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.