-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
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
:
library(ggplot2)
p <- ggplot(mtcars, aes(x=cyl,y=mpg)) + geom_point()
ggsave("cars.png", p)
and run Rscript foo.R
. This produces cars.png
AND Rplots.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