-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Non-interactive calls to ggsave() can have irritating side effects #1326
Comments
👍 This is exactly what's been happening with me as well. Notice the silly, overspecified (but necessary) |
(Incidentally, thank you, @jennybc, for filing the reprex and getting this off of my todo list! :)) |
I may or may not have encountered this problem before 😁 |
Well in the dev version this produces: Desktop : Rscript test.R
Error: No graphics device is open. Please supply height and width
Execution halted but I think we can do a bit better ;) |
Here's a pretty funny GitHub search. Sure there are lots of false positives but I still think the ggplot2 world will rejoice. |
@jennybc that's a brilliant use of GitHub search, you're blowing my mind here. |
Posting an issue sort of on behalf of @cscheid because I am so thrilled at the prospect of this getting fixed! (Please correct me if I'm mangling your problem, @cscheid.)
Calls to
ggsave()
that don't specify device width and height cause a graphics device to be opened and consulted for dimensions. In non-interactive settings, this can have irritating side effects, such as leaving an (empty or corrupt)Rplots.pdf
file behind.Reprex: put these commands in
foo.R
:and run
Rscript foo.R
. This producescars.png
ANDRplots.pdf
, at least on my Mac.Other places people where people have vented about this: stackoverflow thread How to stop R from creating empty Rplots.pdf file when using ggsave and Rscript, ggplot2 board thread ggsave always opens a graphics window on Mac OS
The text was updated successfully, but these errors were encountered: