You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Related feature request #3021 was closed as not desired. ggsave however, indeed creates new directories when saving.
This happens only with png, tiff, and jpeg devices
## all of the below would create a directory that does not exist
ggsave("test/test.png", plot = ggplot())
ggsave("test/test.jpg", plot = ggplot())
ggsave("test/test.tiff", plot = ggplot())
Does not happen with eps, ps, pdf, bmp, svg (error message).
## All of the below give an error message
ggsave("test/test.eps", plot = ggplot())
ggsave("test/test.ps", plot = ggplot())
ggsave("test/test.bmp", plot = ggplot())
ggsave("test/test.svg", plot = ggplot())
ggsave("test/test.pdf", plot = ggplot())
Curious, I suppose that graphics devices control whether they're allowed to create directories.
For consistency reasons ggplot2 might take that control into its own hands, but I'm unsure what the default behaviour should be.
I believe this is new behaviour? Previously ggsave would throw errors if the path did not exist, but now it is creating it's own directories.
I would personally say the default behaviour should be to throw errors, unless specified otherwise, as this could (and has in my case!) wreaked havoc on my project directory.
Related feature request #3021 was closed as not desired. ggsave however, indeed creates new directories when saving.
This happens only with png, tiff, and jpeg devices
Does not happen with eps, ps, pdf, bmp, svg (error message).
P.S. behaviour originally described in this stack overflow thread
The text was updated successfully, but these errors were encountered: